Linux IIO development
 help / color / mirror / Atom feed
* [PATCH 1/2] iio: gyro: check sscanf return value
@ 2015-11-01 12:58 Ioana Ciornei
  2015-11-01 12:58 ` [PATCH 2/2] iio: imu: " Ioana Ciornei
  2015-11-01 18:17 ` [PATCH 1/2] iio: gyro: " Jonathan Cameron
  0 siblings, 2 replies; 7+ messages in thread
From: Ioana Ciornei @ 2015-11-01 12:58 UTC (permalink / raw)
  To: linux-iio, jic23; +Cc: outreachy-kernel, Ioana Ciornei

This patch fixes the checkpatch warnings:
WARNING: unchecked sscanf return value

Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
---

based on linux-iio/testing branch

 drivers/iio/gyro/adis16136.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/gyro/adis16136.c b/drivers/iio/gyro/adis16136.c
index 26de876..bb09bff 100644
--- a/drivers/iio/gyro/adis16136.c
+++ b/drivers/iio/gyro/adis16136.c
@@ -435,7 +435,9 @@ static int adis16136_initial_setup(struct iio_dev *indio_dev)
 	if (ret)
 		return ret;
 
-	sscanf(indio_dev->name, "adis%u\n", &device_id);
+	ret = sscanf(indio_dev->name, "adis%u\n", &device_id);
+	if (ret != 1)
+		return -EINVAL;
 
 	if (prod_id != device_id)
 		dev_warn(&indio_dev->dev, "Device ID(%u) and product ID(%u) do not match.",
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-11-08 15:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-01 12:58 [PATCH 1/2] iio: gyro: check sscanf return value Ioana Ciornei
2015-11-01 12:58 ` [PATCH 2/2] iio: imu: " Ioana Ciornei
2015-11-08 15:45   ` Jonathan Cameron
2015-11-01 18:17 ` [PATCH 1/2] iio: gyro: " Jonathan Cameron
2015-11-01 20:08   ` Ioana Ciornei
2015-11-03  9:22   ` Lars-Peter Clausen
2015-11-08 15:44     ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox