From: Ioana Ciornei Date: Sun, 1 Nov 2015 12:58:44 +0000 (+0200) Subject: iio: gyro: check sscanf return value X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=a106b4748917ba510d083217dbc25e56299f32d4;p=openwrt%2Fstaging%2Fblogic.git iio: gyro: check sscanf return value This patch fixes the checkpatch warnings: WARNING: unchecked sscanf return value Signed-off-by: Ioana Ciornei Acked-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/gyro/adis16136.c b/drivers/iio/gyro/adis16136.c index 26de876b223d..bb09bff25103 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.",