[PATCH 3/5] spi: tle62x0: Use kstrtoul() instead of simple_strtoul()

From: Aayush Kumar

Date: Fri Oct 09 2026 - 09:37:35 EST


Use the recommended kstrtoul() instead of the deprecated
simple_strtoul(). Check the return value and reject invalid values.

Signed-off-by: Aayush Kumar <code@xxxxxxxxxxx>
---
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