[PATCH] staging: iio: adc: ad7816: use sysfs_streq() instead of strcmp()
From: Md. Mahmudul Hasan Mabud
Date: Mon Mar 30 2026 - 03:49:48 EST
Use sysfs_streq() to compare the input buffer with the mode strings.
This is more robust as it ignores trailing newlines, making it safer
for sysfs store functions.
Signed-off-by: Md. Mahmudul Hasan Mabud <mdmahmudulhasan1511@xxxxxxxxx>
---
drivers/staging/iio/adc/ad7816.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index 172acf135..c2544415e 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -136,7 +136,7 @@ static ssize_t ad7816_store_mode(struct device *dev,
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ad7816_chip_info *chip = iio_priv(indio_dev);
- if (strcmp(buf, "full") == 0) {
+ if (sysfs_streq(buf, "full")) {
gpiod_set_value(chip->rdwr_pin, 1);
chip->mode = AD7816_FULL;
} else {
--
2.34.1