Commit 4ce36bbb authored by Wang Shaoyan's avatar Wang Shaoyan Committed by Florian Tobias Schandinat

viafb: replace strict_strtoul to kstrto* and check return value

This commit replace the function strict_strtoul(becasue commit 33ee3b2e), and check the return value to avoid such warning:

  drivers/video/via/viafbdev.c:1992: warning: ignoring return value of 'kstrtoul', declared with attribute warn_unused_result
Signed-off-by: default avatarWang Shaoyan <wangshaoyan.pt@taobao.com>
Signed-off-by: default avatarFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>
parent 94bd217e
...@@ -1158,7 +1158,8 @@ static ssize_t viafb_dvp0_proc_write(struct file *file, ...@@ -1158,7 +1158,8 @@ static ssize_t viafb_dvp0_proc_write(struct file *file,
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
value = strsep(&pbuf, " "); value = strsep(&pbuf, " ");
if (value != NULL) { if (value != NULL) {
strict_strtoul(value, 0, (unsigned long *)&reg_val); if (kstrtou8(value, 0, &reg_val) < 0)
return -EINVAL;
DEBUG_MSG(KERN_INFO "DVP0:reg_val[%l]=:%x\n", i, DEBUG_MSG(KERN_INFO "DVP0:reg_val[%l]=:%x\n", i,
reg_val); reg_val);
switch (i) { switch (i) {
...@@ -1228,7 +1229,8 @@ static ssize_t viafb_dvp1_proc_write(struct file *file, ...@@ -1228,7 +1229,8 @@ static ssize_t viafb_dvp1_proc_write(struct file *file,
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
value = strsep(&pbuf, " "); value = strsep(&pbuf, " ");
if (value != NULL) { if (value != NULL) {
strict_strtoul(value, 0, (unsigned long *)&reg_val); if (kstrtou8(value, 0, &reg_val) < 0)
return -EINVAL;
switch (i) { switch (i) {
case 0: case 0:
viafb_write_reg_mask(CR9B, VIACR, viafb_write_reg_mask(CR9B, VIACR,
...@@ -1286,7 +1288,8 @@ static ssize_t viafb_dfph_proc_write(struct file *file, ...@@ -1286,7 +1288,8 @@ static ssize_t viafb_dfph_proc_write(struct file *file,
if (copy_from_user(&buf[0], buffer, length)) if (copy_from_user(&buf[0], buffer, length))
return -EFAULT; return -EFAULT;
buf[length - 1] = '\0'; /*Ensure end string */ buf[length - 1] = '\0'; /*Ensure end string */
strict_strtoul(&buf[0], 0, (unsigned long *)&reg_val); if (kstrtou8(buf, 0, &reg_val) < 0)
return -EINVAL;
viafb_write_reg_mask(CR97, VIACR, reg_val, 0x0f); viafb_write_reg_mask(CR97, VIACR, reg_val, 0x0f);
return count; return count;
} }
...@@ -1325,7 +1328,8 @@ static ssize_t viafb_dfpl_proc_write(struct file *file, ...@@ -1325,7 +1328,8 @@ static ssize_t viafb_dfpl_proc_write(struct file *file,
if (copy_from_user(&buf[0], buffer, length)) if (copy_from_user(&buf[0], buffer, length))
return -EFAULT; return -EFAULT;
buf[length - 1] = '\0'; /*Ensure end string */ buf[length - 1] = '\0'; /*Ensure end string */
strict_strtoul(&buf[0], 0, (unsigned long *)&reg_val); if (kstrtou8(buf, 0, &reg_val) < 0)
return -EINVAL;
viafb_write_reg_mask(CR99, VIACR, reg_val, 0x0f); viafb_write_reg_mask(CR99, VIACR, reg_val, 0x0f);
return count; return count;
} }
...@@ -1394,8 +1398,8 @@ static ssize_t viafb_vt1636_proc_write(struct file *file, ...@@ -1394,8 +1398,8 @@ static ssize_t viafb_vt1636_proc_write(struct file *file,
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
value = strsep(&pbuf, " "); value = strsep(&pbuf, " ");
if (value != NULL) { if (value != NULL) {
strict_strtoul(value, 0, if (kstrtou8(value, 0, &reg_val.Data) < 0)
(unsigned long *)&reg_val.Data); return -EINVAL;
switch (i) { switch (i) {
case 0: case 0:
reg_val.Index = 0x08; reg_val.Index = 0x08;
...@@ -1431,8 +1435,8 @@ static ssize_t viafb_vt1636_proc_write(struct file *file, ...@@ -1431,8 +1435,8 @@ static ssize_t viafb_vt1636_proc_write(struct file *file,
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
value = strsep(&pbuf, " "); value = strsep(&pbuf, " ");
if (value != NULL) { if (value != NULL) {
strict_strtoul(value, 0, if (kstrtou8(value, 0, &reg_val.Data) < 0)
(unsigned long *)&reg_val.Data); return -EINVAL;
switch (i) { switch (i) {
case 0: case 0:
reg_val.Index = 0x08; reg_val.Index = 0x08;
...@@ -1946,61 +1950,67 @@ static int __init viafb_setup(void) ...@@ -1946,61 +1950,67 @@ static int __init viafb_setup(void)
if (!*this_opt) if (!*this_opt)
continue; continue;
if (!strncmp(this_opt, "viafb_mode1=", 12)) if (!strncmp(this_opt, "viafb_mode1=", 12)) {
viafb_mode1 = kstrdup(this_opt + 12, GFP_KERNEL); viafb_mode1 = kstrdup(this_opt + 12, GFP_KERNEL);
else if (!strncmp(this_opt, "viafb_mode=", 11)) } else if (!strncmp(this_opt, "viafb_mode=", 11)) {
viafb_mode = kstrdup(this_opt + 11, GFP_KERNEL); viafb_mode = kstrdup(this_opt + 11, GFP_KERNEL);
else if (!strncmp(this_opt, "viafb_bpp1=", 11)) } else if (!strncmp(this_opt, "viafb_bpp1=", 11)) {
strict_strtoul(this_opt + 11, 0, if (kstrtouint(this_opt + 11, 0, &viafb_bpp1) < 0)
(unsigned long *)&viafb_bpp1); return -EINVAL;
else if (!strncmp(this_opt, "viafb_bpp=", 10)) } else if (!strncmp(this_opt, "viafb_bpp=", 10)) {
strict_strtoul(this_opt + 10, 0, if (kstrtouint(this_opt + 10, 0, &viafb_bpp) < 0)
(unsigned long *)&viafb_bpp); return -EINVAL;
else if (!strncmp(this_opt, "viafb_refresh1=", 15)) } else if (!strncmp(this_opt, "viafb_refresh1=", 15)) {
strict_strtoul(this_opt + 15, 0, if (kstrtoint(this_opt + 15, 0, &viafb_refresh1) < 0)
(unsigned long *)&viafb_refresh1); return -EINVAL;
else if (!strncmp(this_opt, "viafb_refresh=", 14)) } else if (!strncmp(this_opt, "viafb_refresh=", 14)) {
strict_strtoul(this_opt + 14, 0, if (kstrtoint(this_opt + 14, 0, &viafb_refresh) < 0)
(unsigned long *)&viafb_refresh); return -EINVAL;
else if (!strncmp(this_opt, "viafb_lcd_dsp_method=", 21)) } else if (!strncmp(this_opt, "viafb_lcd_dsp_method=", 21)) {
strict_strtoul(this_opt + 21, 0, if (kstrtoint(this_opt + 21, 0,
(unsigned long *)&viafb_lcd_dsp_method); &viafb_lcd_dsp_method) < 0)
else if (!strncmp(this_opt, "viafb_lcd_panel_id=", 19)) return -EINVAL;
strict_strtoul(this_opt + 19, 0, } else if (!strncmp(this_opt, "viafb_lcd_panel_id=", 19)) {
(unsigned long *)&viafb_lcd_panel_id); if (kstrtoint(this_opt + 19, 0,
else if (!strncmp(this_opt, "viafb_accel=", 12)) &viafb_lcd_panel_id) < 0)
strict_strtoul(this_opt + 12, 0, return -EINVAL;
(unsigned long *)&viafb_accel); } else if (!strncmp(this_opt, "viafb_accel=", 12)) {
else if (!strncmp(this_opt, "viafb_SAMM_ON=", 14)) if (kstrtoint(this_opt + 12, 0, &viafb_accel) < 0)
strict_strtoul(this_opt + 14, 0, return -EINVAL;
(unsigned long *)&viafb_SAMM_ON); } else if (!strncmp(this_opt, "viafb_SAMM_ON=", 14)) {
else if (!strncmp(this_opt, "viafb_active_dev=", 17)) if (kstrtoint(this_opt + 14, 0, &viafb_SAMM_ON) < 0)
return -EINVAL;
} else if (!strncmp(this_opt, "viafb_active_dev=", 17)) {
viafb_active_dev = kstrdup(this_opt + 17, GFP_KERNEL); viafb_active_dev = kstrdup(this_opt + 17, GFP_KERNEL);
else if (!strncmp(this_opt, } else if (!strncmp(this_opt,
"viafb_display_hardware_layout=", 30)) "viafb_display_hardware_layout=", 30)) {
strict_strtoul(this_opt + 30, 0, if (kstrtoint(this_opt + 30, 0,
(unsigned long *)&viafb_display_hardware_layout); &viafb_display_hardware_layout) < 0)
else if (!strncmp(this_opt, "viafb_second_size=", 18)) return -EINVAL;
strict_strtoul(this_opt + 18, 0, } else if (!strncmp(this_opt, "viafb_second_size=", 18)) {
(unsigned long *)&viafb_second_size); if (kstrtoint(this_opt + 18, 0, &viafb_second_size) < 0)
else if (!strncmp(this_opt, return -EINVAL;
"viafb_platform_epia_dvi=", 24)) } else if (!strncmp(this_opt,
strict_strtoul(this_opt + 24, 0, "viafb_platform_epia_dvi=", 24)) {
(unsigned long *)&viafb_platform_epia_dvi); if (kstrtoint(this_opt + 24, 0,
else if (!strncmp(this_opt, &viafb_platform_epia_dvi) < 0)
"viafb_device_lcd_dualedge=", 26)) return -EINVAL;
strict_strtoul(this_opt + 26, 0, } else if (!strncmp(this_opt,
(unsigned long *)&viafb_device_lcd_dualedge); "viafb_device_lcd_dualedge=", 26)) {
else if (!strncmp(this_opt, "viafb_bus_width=", 16)) if (kstrtoint(this_opt + 26, 0,
strict_strtoul(this_opt + 16, 0, &viafb_device_lcd_dualedge) < 0)
(unsigned long *)&viafb_bus_width); return -EINVAL;
else if (!strncmp(this_opt, "viafb_lcd_mode=", 15)) } else if (!strncmp(this_opt, "viafb_bus_width=", 16)) {
strict_strtoul(this_opt + 15, 0, if (kstrtoint(this_opt + 16, 0, &viafb_bus_width) < 0)
(unsigned long *)&viafb_lcd_mode); return -EINVAL;
else if (!strncmp(this_opt, "viafb_lcd_port=", 15)) } else if (!strncmp(this_opt, "viafb_lcd_mode=", 15)) {
if (kstrtoint(this_opt + 15, 0, &viafb_lcd_mode) < 0)
return -EINVAL;
} else if (!strncmp(this_opt, "viafb_lcd_port=", 15)) {
viafb_lcd_port = kstrdup(this_opt + 15, GFP_KERNEL); viafb_lcd_port = kstrdup(this_opt + 15, GFP_KERNEL);
else if (!strncmp(this_opt, "viafb_dvi_port=", 15)) } else if (!strncmp(this_opt, "viafb_dvi_port=", 15)) {
viafb_dvi_port = kstrdup(this_opt + 15, GFP_KERNEL); viafb_dvi_port = kstrdup(this_opt + 15, GFP_KERNEL);
}
} }
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment