[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240208184919.2224986-5-andriy.shevchenko@linux.intel.com>
Date: Thu, 8 Feb 2024 20:48:02 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Miguel Ojeda <ojeda@...nel.org>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Robin van der Gracht <robin@...tonic.nl>,
Paul Burton <paulburton@...nel.org>,
Geert Uytterhoeven <geert+renesas@...der.be>
Subject: [PATCH v1 04/15] 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.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
drivers/auxdisplay/line-display.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/auxdisplay/line-display.c b/drivers/auxdisplay/line-display.c
index c4dbb13293d1..4b92ae7781f1 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 ret;
- if (kstrtouint(buf, 10, &ms) != 0)
- return -EINVAL;
+ ret = kstrtouint(buf, 10, &ms);
+ if (ret)
+ return ret;
linedisp->scroll_rate = msecs_to_jiffies(ms);
if (linedisp->message && linedisp->message_len > linedisp->num_chars) {
--
2.43.0.rc1.1.gbec44491f096
Powered by blists - more mailing lists