From: Aayush Kumar <code@aayushk.dev>
To: broonie@kernel.org
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
Aayush Kumar <code@aayushk.dev>
Subject: [PATCH 3/5] spi: tle62x0: Use kstrtoul() instead of simple_strtoul()
Date: Fri, 9 Oct 2026 19:06:07 +0530 [thread overview]
Message-ID: <20261009133609.579046-4-code@aayushk.dev> (raw)
In-Reply-To: <20261009133609.579046-1-code@aayushk.dev>
Use the recommended kstrtoul() instead of the deprecated
simple_strtoul(). Check the return value and reject invalid values.
Signed-off-by: Aayush Kumar <code@aayushk.dev>
---
drivers/spi/spi-tle62x0.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/spi/spi-tle62x0.c b/drivers/spi/spi-tle62x0.c
index dd8bfb3f3..986d78ab4 100644
--- a/drivers/spi/spi-tle62x0.c
+++ b/drivers/spi/spi-tle62x0.c
@@ -151,10 +151,10 @@ static ssize_t tle62x0_gpio_store(struct device *dev,
struct tle62x0_state *st = dev_get_drvdata(dev);
int gpio_num = to_gpio_num(attr);
unsigned long val;
- char *endp;
+ int ret;
- val = simple_strtoul(buf, &endp, 0);
- if (buf == endp)
+ ret = kstrtoul(buf, 0, &val);
+ if (ret)
return -EINVAL;
dev_dbg(dev, "setting gpio %d to %ld\n", gpio_num, val);
--
2.56.0
next prev parent reply other threads:[~2026-10-09 13:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 13:36 [PATCH 0/5] spi: replace strcpy(), sprintf() and simple_strtoul() with strscpy(), snprintf() and kstrtoul() Aayush Kumar
2026-10-09 13:36 ` [PATCH 1/5] spi: butterfly: Use strscpy() instead of strcpy() Aayush Kumar
2026-10-09 13:36 ` [PATCH 2/5] spi: lm70llp: " Aayush Kumar
2026-10-09 14:28 ` David Laight
2026-10-09 17:13 ` Aayush Kumar
2026-10-09 13:36 ` Aayush Kumar [this message]
2026-10-09 13:36 ` [PATCH 4/5] spi: omap2-mcspi: Use snprintf() instead of sprintf() Aayush Kumar
2026-10-09 13:36 ` [PATCH 5/5] spi: s3c64xx: " Aayush Kumar
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=20261009133609.579046-4-code@aayushk.dev \
--to=code@aayushk.dev \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.