summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2024-02-12 20:01:37 +0300
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2024-02-15 14:31:20 +0300
commit7168791fcab5bde00b6c777924addff014d0e359 (patch)
tree5d1934582c153db99a86c1fcec54bfb547f297a5
parent50d6b9d56e69563d3b261ee25bc644c59c5bff58 (diff)
downloadlinux-7168791fcab5bde00b6c777924addff014d0e359.tar.xz
auxdisplay: linedisp: Unshadow error codes in ->store()
kstrtox() may return different error codes. Unshadow them in the ->store() callback to give better error report. While at it, add missing kstrtox.h inclusion. Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org> Tested-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-rw-r--r--drivers/auxdisplay/line-display.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/auxdisplay/line-display.c b/drivers/auxdisplay/line-display.c
index c4dbb13293d1..8d91c2099661 100644
--- a/drivers/auxdisplay/line-display.c
+++ b/drivers/auxdisplay/line-display.c
@@ -12,6 +12,7 @@
#include <linux/device.h>
#include <linux/idr.h>
+#include <linux/kstrtox.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/string.h>
@@ -166,9 +167,11 @@ static ssize_t scroll_step_ms_store(struct device *dev,
{
struct linedisp *linedisp = container_of(dev, struct linedisp, dev);
unsigned int ms;
+ int err;
- if (kstrtouint(buf, 10, &ms) != 0)
- return -EINVAL;
+ err = kstrtouint(buf, 10, &ms);
+ if (err)
+ return err;
linedisp->scroll_rate = msecs_to_jiffies(ms);
if (linedisp->message && linedisp->message_len > linedisp->num_chars) {