Commit 7168791f authored by Andy Shevchenko's avatar Andy Shevchenko

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: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Tested-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent 50d6b9d5
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/idr.h> #include <linux/idr.h>
#include <linux/kstrtox.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/string.h> #include <linux/string.h>
...@@ -166,9 +167,11 @@ static ssize_t scroll_step_ms_store(struct device *dev, ...@@ -166,9 +167,11 @@ static ssize_t scroll_step_ms_store(struct device *dev,
{ {
struct linedisp *linedisp = container_of(dev, struct linedisp, dev); struct linedisp *linedisp = container_of(dev, struct linedisp, dev);
unsigned int ms; unsigned int ms;
int err;
if (kstrtouint(buf, 10, &ms) != 0) err = kstrtouint(buf, 10, &ms);
return -EINVAL; if (err)
return err;
linedisp->scroll_rate = msecs_to_jiffies(ms); linedisp->scroll_rate = msecs_to_jiffies(ms);
if (linedisp->message && linedisp->message_len > linedisp->num_chars) { if (linedisp->message && linedisp->message_len > linedisp->num_chars) {
......
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