hdmirx: fix coverity errors

PD#167692: hdmirx: fix coverity errors

Change-Id: I044b9e84f090e1f7b1652891522eeb1adb1ed0ac
Signed-off-by: yicheng shen <yicheng.shen@amlogic.com>
This commit is contained in:
yicheng shen
2018-06-06 13:39:31 +08:00
committed by Yixun Lan
parent 7fedb276a6
commit 40d9d7dc94
5 changed files with 23 additions and 23 deletions

View File

@@ -1001,7 +1001,7 @@ static long hdmirx_ioctl(struct file *file, unsigned int cmd,
memset(&pkt_info, 0, sizeof(pkt_info));
srcbuff = &pkt_info;
size = sizeof(struct pd_infoframe_s);
rx_get_pd_fifo_param(param, &pkt_info, size);
rx_get_pd_fifo_param(param, &pkt_info);
/*return pkt info*/
if ((size > 0) && (srcbuff != NULL) && (argp != NULL)) {
@@ -1137,7 +1137,7 @@ int rx_pr(const char *fmt, ...)
else
break;
strcpy(buf + 5, fmt + pos);
strncpy(buf + 5, fmt + pos, (sizeof(buf) - 5));
} else
strcpy(buf, fmt);
/* if (fmt[strlen(fmt) - 1] == '\n') */
@@ -1468,19 +1468,19 @@ static void hdmirx_get_base_addr(struct device_node *node)
}
}
static int hdmirx_switch_pinmux(struct device dev)
static int hdmirx_switch_pinmux(struct device *dev)
{
struct pinctrl *pin;
const char *pin_name;
int ret = 0;
/* pinmux set */
if (dev.of_node) {
ret = of_property_read_string_index(dev.of_node,
if (dev->of_node) {
ret = of_property_read_string_index(dev->of_node,
"pinctrl-names",
0, &pin_name);
if (!ret)
pin = devm_pinctrl_get_select(&dev, pin_name);
pin = devm_pinctrl_get_select(dev, pin_name);
/* rx_pr("hdmirx: pinmux:%p, name:%s\n", */
/* pin, pin_name); */
}
@@ -1523,6 +1523,12 @@ static int hdmirx_probe(struct platform_device *pdev)
log_init(DEF_LOG_BUF_SIZE);
pEdid_buffer = (unsigned char *) pdev->dev.platform_data;
hdmirx_dev = &pdev->dev;
/*get compatible matched device, to get chip related data*/
of_id = of_match_device(hdmirx_dt_match, &pdev->dev);
if (!of_id) {
rx_pr("unable to get matched device\n");
return -1;
}
/* allocate memory for the per-device structure */
hdevp = kmalloc(sizeof(struct hdmirx_dev_s), GFP_KERNEL);
if (!hdevp) {
@@ -1531,10 +1537,6 @@ static int hdmirx_probe(struct platform_device *pdev)
goto fail_kmalloc_hdev;
}
memset(hdevp, 0, sizeof(struct hdmirx_dev_s));
/*get compatible matched device, to get chip related data*/
of_id = of_match_device(hdmirx_dt_match, &pdev->dev);
if (!of_id)
rx_pr("unable to get matched device\n");
hdevp->data = of_id->data;
if (hdevp->data)
rx.chip_id = hdevp->data->chip_id;
@@ -1780,7 +1782,7 @@ static int hdmirx_probe(struct platform_device *pdev)
en_4k_timing = 1;
hdmirx_hw_probe();
hdmirx_switch_pinmux(pdev->dev);
hdmirx_switch_pinmux(&(pdev->dev));
#ifdef CONFIG_HAS_EARLYSUSPEND
register_early_suspend(&hdmirx_early_suspend_handler);
#endif

View File

@@ -49,7 +49,10 @@ struct st_eq_data eq_ch2;
enum eq_sts_e eq_sts = E_EQ_START;
/* variable define*/
int long_cable_best_setting = 6;
int delay_ms_cnt = 10; /* 5 */
int delay_ms_cnt = 5; /* 5 */
MODULE_PARM_DESC(delay_ms_cnt, "\n delay_ms_cnt\n");
module_param(delay_ms_cnt, int, 0664);
int eq_max_setting = 7;
int eq_dbg_ch0;
int eq_dbg_ch1;
@@ -325,7 +328,7 @@ uint8_t testType(uint16_t setting, struct st_eq_data *ch_data)
uint8_t aquireEarlyCnt(uint16_t setting)
{
uint16_t lockVector = 0x0001;
int timeout_cnt = 20;
int timeout_cnt = 10;
lockVector = lockVector << setting;
hdmi_rx_phy_ConfEqualSetting(lockVector);

View File

@@ -186,8 +186,7 @@ void rx_pkt_debug(void)
void rx_get_pd_fifo_param(enum pkt_type_e pkt_type,
struct pd_infoframe_s *pkt_info,
unsigned int size)
struct pd_infoframe_s *pkt_info)
{
switch (pkt_type) {
case PKT_TYPE_INFOFRAME_VSI:
@@ -288,15 +287,12 @@ void rx_get_pd_fifo_param(enum pkt_type_e pkt_type,
rx_pkt_get_amp_ex(&pkt_info);
break;
default:
size = PFIFO_SIZE * sizeof(uint32_t);
if (pd_fifo_buf != NULL)
/* srcbuff = pd_fifo_buf; */
memcpy(&pkt_info, &pd_fifo_buf,
sizeof(struct pd_infoframe_s));
else {
size = 0;
else
pr_err("err:pd_fifo_buf is empty\n");
}
break;
}
}
@@ -1351,7 +1347,7 @@ void rx_get_vsi_info(void)
/*3d VSI*/
if (pkt->sbpkt.vsi_3Dext.vdfmt == VSI_FORMAT_3D_FORMAT) {
rx.vs_info_details._3d_structure =
rx.vs_info_details._3d_structure;
pkt->sbpkt.vsi_3Dext.threeD_st;
rx.vs_info_details._3d_ext_data =
pkt->sbpkt.vsi_3Dext.threeD_ex;
if (log_level & VSI_LOG)

View File

@@ -971,8 +971,7 @@ extern void rx_pkt_clr_attach_drm(void);
extern uint32_t rx_pkt_chk_busy_vsi(void);
extern uint32_t rx_pkt_chk_busy_drm(void);
extern void rx_get_pd_fifo_param(enum pkt_type_e pkt_type,
struct pd_infoframe_s *pkt_info,
unsigned int size);
struct pd_infoframe_s *pkt_info);
#endif

View File

@@ -355,7 +355,7 @@ void rx_modify_edid(unsigned char *buffer,
addition_size = (*addition & 0x1f) + 1;
cur_data = kmalloc(
addition_size + cur_size, GFP_KERNEL);
if (cur_data != 0) {
if (!cur_data) {
rx_pr("allocate cur_data memory failed\n");
return;
}