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 26de876b223d07cb7d51c437d3dec0047bf7a2ce..bb09bff251031bdc4ccf0cf836dd40e706d8faa3 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.",