From: Andy Shevchenko Date: Mon, 12 Feb 2024 17:01:37 +0000 (+0200) Subject: auxdisplay: linedisp: Unshadow error codes in ->store() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=7168791fcab5bde00b6c777924addff014d0e359;p=linux.git 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 Tested-by: Geert Uytterhoeven Signed-off-by: Andy Shevchenko --- diff --git a/drivers/auxdisplay/line-display.c b/drivers/auxdisplay/line-display.c index c4dbb13293d13..8d91c20996618 100644 --- a/drivers/auxdisplay/line-display.c +++ b/drivers/auxdisplay/line-display.c @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -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) {