diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/misc/lkdtm.c | 2 | ||||
| -rw-r--r-- | drivers/power/supply/qcom/qpnp-fg-gen3.c | 4 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_hdmi_tx.c | 124 |
3 files changed, 100 insertions, 30 deletions
diff --git a/drivers/misc/lkdtm.c b/drivers/misc/lkdtm.c index 849592f45889..58f2aef5d236 100644 --- a/drivers/misc/lkdtm.c +++ b/drivers/misc/lkdtm.c @@ -348,7 +348,7 @@ static noinline void corrupt_stack(void) /* Use default char array length that triggers stack protection. */ char data[8]; - memset((void *)data, 0, 64); + memset((void *)data, 0, sizeof(char)*8); } static void execute_location(void *dst) diff --git a/drivers/power/supply/qcom/qpnp-fg-gen3.c b/drivers/power/supply/qcom/qpnp-fg-gen3.c index a546621d0837..32fb0538cc8c 100644 --- a/drivers/power/supply/qcom/qpnp-fg-gen3.c +++ b/drivers/power/supply/qcom/qpnp-fg-gen3.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -2608,7 +2608,7 @@ static void clear_cycle_counter(struct fg_chip *chip) } rc = fg_sram_write(chip, CYCLE_COUNT_WORD, CYCLE_COUNT_OFFSET, (u8 *)&chip->cyc_ctr.count, - sizeof(chip->cyc_ctr.count) / sizeof(u8 *), + sizeof(chip->cyc_ctr.count) / (sizeof(u8 *)), FG_IMA_DEFAULT); if (rc < 0) pr_err("failed to clear cycle counter rc=%d\n", rc); diff --git a/drivers/video/fbdev/msm/mdss_hdmi_tx.c b/drivers/video/fbdev/msm/mdss_hdmi_tx.c index b70937a8f5fe..747c245bf78e 100644 --- a/drivers/video/fbdev/msm/mdss_hdmi_tx.c +++ b/drivers/video/fbdev/msm/mdss_hdmi_tx.c @@ -509,8 +509,13 @@ void *hdmi_get_featuredata_from_sysfs_dev(struct device *device, { struct hdmi_tx_ctrl *hdmi_ctrl = NULL; - if (!device || feature_type >= HDMI_TX_FEAT_MAX) { - DEV_ERR("%s: invalid input\n", __func__); + if (!device) { + DEV_ERR("%s: invalid device data\n", __func__); + return NULL; + } + + if (feature_type >= HDMI_TX_FEAT_MAX) { + DEV_ERR("%s: feature_type exceeding max value\n", __func__); return NULL; } @@ -583,8 +588,13 @@ static ssize_t hdmi_tx_sysfs_wta_edid(struct device *dev, hdmi_ctrl = hdmi_tx_get_drvdata_from_sysfs_dev(dev); - if (!hdmi_ctrl || !hdmi_ctrl->edid_buf) { - DEV_ERR("%s: invalid data\n", __func__); + if (!hdmi_ctrl) { + DEV_ERR("%s: invalid hdmi_ctrl data\n", __func__); + return -EINVAL; + } + + if (!hdmi_ctrl->edid_buf) { + DEV_ERR("%s: invalid edid_buf data\n", __func__); return -EINVAL; } @@ -635,8 +645,13 @@ static ssize_t hdmi_tx_sysfs_rda_edid(struct device *dev, hdmi_ctrl = hdmi_tx_get_drvdata_from_sysfs_dev(dev); - if (!hdmi_ctrl || !hdmi_ctrl->edid_buf) { - DEV_ERR("%s: invalid data\n", __func__); + if (!hdmi_ctrl) { + DEV_ERR("%s: invalid hdmi_ctrl data\n", __func__); + return -EINVAL; + } + + if (!hdmi_ctrl->edid_buf) { + DEV_ERR("%s: invalid edid_buf data\n", __func__); return -EINVAL; } @@ -1495,8 +1510,13 @@ static int hdmi_tx_sysfs_create(struct hdmi_tx_ctrl *hdmi_ctrl, { int rc; - if (!hdmi_ctrl || !fbi) { - DEV_ERR("%s: invalid input\n", __func__); + if (!hdmi_ctrl) { + DEV_ERR("%s: invalid hdmi_ctrl data\n", __func__); + return -ENODEV; + } + + if (!fbi) { + DEV_ERR("%s: invalid fb_info data\n", __func__); return -ENODEV; } @@ -2163,8 +2183,14 @@ static int hdmi_tx_init_features(struct hdmi_tx_ctrl *hdmi_ctrl, int ret = 0; u32 deinit_features = 0; - if (!hdmi_ctrl || !fbi) { - DEV_ERR("%s: invalid input\n", __func__); + if (!hdmi_ctrl) { + DEV_ERR("%s: invalid hdmi_ctrl data\n", __func__); + ret = -EINVAL; + goto end; + } + + if (!fbi) { + DEV_ERR("%s: invalid fb_info data\n", __func__); ret = -EINVAL; goto end; } @@ -2761,8 +2787,14 @@ static int hdmi_tx_config_power(struct hdmi_tx_ctrl *hdmi_ctrl, struct dss_module_power *power_data = NULL; char name[MAX_CLIENT_NAME_LEN]; - if (!hdmi_ctrl || module >= HDMI_TX_MAX_PM) { - DEV_ERR("%s: Error: invalid input\n", __func__); + if (!hdmi_ctrl) { + DEV_ERR("%s: invalid hdmi_ctrl data\n", __func__); + rc = -EINVAL; + goto exit; + } + + if (module >= HDMI_TX_MAX_PM) { + DEV_ERR("%s: power_module exceeding max value\n", __func__); rc = -EINVAL; goto exit; } @@ -2829,8 +2861,14 @@ static int hdmi_tx_enable_power(struct hdmi_tx_ctrl *hdmi_ctrl, int rc = 0; struct dss_module_power *power_data = NULL; - if (!hdmi_ctrl || module >= HDMI_TX_MAX_PM) { - DEV_ERR("%s: Error: invalid input\n", __func__); + if (!hdmi_ctrl) { + DEV_ERR("%s: invalid hdmi_ctrl data\n", __func__); + rc = -EINVAL; + goto error; + } + + if (module >= HDMI_TX_MAX_PM) { + DEV_ERR("%s: power_module exceeding max value\n", __func__); rc = -EINVAL; goto error; } @@ -3170,8 +3208,13 @@ static int hdmi_tx_audio_info_setup(struct platform_device *pdev, struct hdmi_tx_ctrl *hdmi_ctrl = platform_get_drvdata(pdev); u32 is_mode_dvi; - if (!hdmi_ctrl || !params) { - DEV_ERR("%s: invalid input\n", __func__); + if (!hdmi_ctrl) { + DEV_ERR("%s: invalid hdmi_ctrl data\n", __func__); + return -ENODEV; + } + + if (!params) { + DEV_ERR("%s: invalid audio_setup params\n", __func__); return -ENODEV; } @@ -4637,8 +4680,14 @@ static int hdmi_tx_get_dt_clk_data(struct device *dev, struct dss_module_power *hpd_power_data = NULL; struct dss_module_power *core_power_data = NULL; - if (!dev || !pdata) { - pr_err("%s: invalid input\n", __func__); + if (!dev) { + pr_err("%s: invalid device data\n", __func__); + rc = -EINVAL; + goto exit; + } + + if (!pdata) { + pr_err("%s: invalid hdmi platform data\n", __func__); rc = -EINVAL; goto exit; } @@ -4711,8 +4760,13 @@ static int hdmi_tx_get_dt_vreg_data(struct device *dev, const char *mod_name = NULL; struct device_node *of_node = NULL; - if (!dev || !mp) { - DEV_ERR("%s: invalid input\n", __func__); + if (!dev) { + DEV_ERR("%s: invalid device data\n", __func__); + return -EINVAL; + } + + if (!mp) { + DEV_ERR("%s: invalid power_module data\n", __func__); return -EINVAL; } @@ -4901,15 +4955,20 @@ static int hdmi_tx_get_dt_gpio_data(struct device *dev, struct dss_gpio *gpio_list = NULL; struct device_node *of_node = NULL; - DEV_DBG("%s: module: '%s'\n", __func__, hdmi_tx_pm_name(module_type)); + if (!dev) { + DEV_ERR("%s: invalid device data\n", __func__); + return -EINVAL; + } - if (!dev || !mp) { - DEV_ERR("%s: invalid input\n", __func__); + if (!mp) { + DEV_ERR("%s: invalid power_module data\n", __func__); return -EINVAL; } of_node = dev->of_node; + DEV_DBG("%s: module: '%s'\n", __func__, hdmi_tx_pm_name(module_type)); + switch (module_type) { case HDMI_TX_HPD_PM: gpio_list_size = ARRAY_SIZE(hpd_gpio_config); @@ -4982,8 +5041,14 @@ static void hdmi_tx_put_dt_data(struct device *dev, struct hdmi_tx_platform_data *pdata) { int i; - if (!dev || !pdata) { - DEV_ERR("%s: invalid input\n", __func__); + + if (!dev) { + pr_err("%s: invalid device data\n", __func__); + return; + } + + if (!pdata) { + pr_err("%s: invalid hdmi platform data\n", __func__); return; } @@ -5005,8 +5070,13 @@ static int hdmi_tx_get_dt_data(struct platform_device *pdev, struct hdmi_tx_ctrl *hdmi_ctrl = platform_get_drvdata(pdev); const char *data; - if (!pdev || !pdata) { - DEV_ERR("%s: invalid input\n", __func__); + if (!pdev) { + pr_err("%s: invalid platform_device data\n", __func__); + return -EINVAL; + } + + if (!pdata) { + pr_err("%s: invalid hdmi platform data\n", __func__); return -EINVAL; } |
