[PATCH v2 1/3] spi: tle62x0: Use kstrtoul() instead of simple_strtoul()
From: Aayush Kumar
Date: Sat Oct 10 2026 - 04:35:50 EST
From: Aayush Kumar <aayushkmx@xxxxxxxxx>
Use the recommended kstrtoul() instead of the deprecated
simple_strtoul(). Check the return value and reject invalid values.
Signed-off-by: Aayush Kumar <aayushkmx@xxxxxxxxx>
---
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