iio: gyro: check sscanf return value
authorIoana Ciornei <ciorneiioana@gmail.com>
Sun, 1 Nov 2015 12:58:44 +0000 (14:58 +0200)
committerJonathan Cameron <jic23@kernel.org>
Sun, 8 Nov 2015 15:43:16 +0000 (15:43 +0000)
This patch fixes the checkpatch warnings:
WARNING: unchecked sscanf return value

Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/gyro/adis16136.c

index 26de876..bb09bff 100644 (file)
@@ -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.",