From: Shreeya Patel Date: Sun, 4 Mar 2018 12:43:12 +0000 (+0530) Subject: Staging: iio: adis16209: Adjust a switch statement X-Git-Tag: v4.19~1302^2~205^2~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0df8baeab1ee2a5ccd3c725a44a431fcc63fe416;p=platform%2Fkernel%2Flinux-rpi.git Staging: iio: adis16209: Adjust a switch statement Adjust a switch block to explicitly match channels and return -EINVAL as default case which makes the code semantically more clear. Signed-off-by: Shreeya Patel Signed-off-by: Jonathan Cameron --- diff --git a/drivers/staging/iio/accel/adis16209.c b/drivers/staging/iio/accel/adis16209.c index 68a2f2f..8ffde7e 100644 --- a/drivers/staging/iio/accel/adis16209.c +++ b/drivers/staging/iio/accel/adis16209.c @@ -155,10 +155,16 @@ static int adis16209_read_raw(struct iio_dev *indio_dev, switch (chan->type) { case IIO_VOLTAGE: *val = 0; - if (chan->channel == 0) + switch (chan->channel) { + case 0: *val2 = 305180; /* 0.30518 mV */ - else + break; + case 1: *val2 = 610500; /* 0.6105 mV */ + break; + default: + return -EINVAL; + } return IIO_VAL_INT_PLUS_MICRO; case IIO_TEMP: *val = -470;