From: Jad Keskes <inasj268@gmail.com>
To: gregkh@linuxfoundation.org
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Jad Keskes <inasj268@gmail.com>
Subject: [PATCH] usb: misc: usbsevseg: replace deprecated simple_strtoul with kstrtouint
Date: Mon, 22 Jun 2026 13:50:45 +0100 [thread overview]
Message-ID: <20260622125045.2398164-1-inasj268@gmail.com> (raw)
simple_strtoul() is deprecated. kstrtouint() actually tells you when
the input is garbage instead of silently accepting zero.
Fixes 3 sysfs store paths (powered, mode_msb, mode_lsb) from one
macro expansion.
Signed-off-by: Jad Keskes <inasj268@gmail.com>
---
drivers/usb/misc/usbsevseg.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/misc/usbsevseg.c b/drivers/usb/misc/usbsevseg.c
index 89d25fcef642..2c08d8ee7d86 100644
--- a/drivers/usb/misc/usbsevseg.c
+++ b/drivers/usb/misc/usbsevseg.c
@@ -154,7 +154,13 @@ static ssize_t name##_store(struct device *dev, \
struct usb_interface *intf = to_usb_interface(dev); \
struct usb_sevsegdev *mydev = usb_get_intfdata(intf); \
\
- mydev->name = simple_strtoul(buf, NULL, 10); \
+ unsigned int val; \
+ int ret; \
+ \
+ ret = kstrtouint(buf, 10, &val); \
+ if (ret < 0) \
+ return ret; \
+ mydev->name = val; \
update_fcn(mydev); \
\
return count; \
--
2.54.0
next reply other threads:[~2026-06-22 12:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-22 12:50 Jad Keskes [this message]
2026-06-22 13:03 ` [PATCH] usb: misc: usbsevseg: replace deprecated simple_strtoul with kstrtouint Oliver Neukum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260622125045.2398164-1-inasj268@gmail.com \
--to=inasj268@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox