Skip to content

Commit a71266e

Browse files
Dan Carpenterjic23
authored andcommitted
iio: adis16400: Fix an error code in adis16400_initial_setup()
This is to silence a new Smatch warning: drivers/iio/imu/adis16400.c:492 adis16400_initial_setup() warn: sscanf doesn't return error codes If the condition "if (st->variant->flags & ADIS16400_HAS_SLOW_MODE) {" is false then we return 1 instead of returning 0 and probe will fail. Fixes: 72a868b ("iio: imu: check sscanf return value") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: <Stable@vger.kernel.org> Link: https://lore.kernel.org/r/YCwgFb3JVG6qrlQ+@mwanda Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent be24c65 commit a71266e

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

drivers/iio/imu/adis16400.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,7 @@ static int adis16400_initial_setup(struct iio_dev *indio_dev)
462462
if (ret)
463463
goto err_ret;
464464

465-
ret = sscanf(indio_dev->name, "adis%u\n", &device_id);
466-
if (ret != 1) {
465+
if (sscanf(indio_dev->name, "adis%u\n", &device_id) != 1) {
467466
ret = -EINVAL;
468467
goto err_ret;
469468
}

0 commit comments

Comments
 (0)