auxdisplay: linedisp: Unshadow error codes in ->store()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 12 Feb 2024 17:01:37 +0000 (19:01 +0200)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 15 Feb 2024 11:31:20 +0000 (13:31 +0200)
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>
drivers/auxdisplay/line-display.c

index c4dbb13..8d91c20 100644 (file)
@@ -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) {