summaryrefslogtreecommitdiff
path: root/drivers/iio/adc/ina2xx-adc.c
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2018-10-16 19:14:18 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2018-10-21 17:43:11 +0300
commitd42282db6c41cd1896090c3bc95fc9cfd7268189 (patch)
tree91df9df6da2666fa0c580218f337b9149b6c1c45 /drivers/iio/adc/ina2xx-adc.c
parente480490c90956f8e46ba666b49bc56000083bbfe (diff)
downloadlinux-d42282db6c41cd1896090c3bc95fc9cfd7268189.tar.xz
iio: adc: ina2xx: add in early -EINVAL returns in case statements
Static analysis with CoverityScan is throwing warnings that specific case statements are missing breaks. Rather than adding breaks, add return -EINVAL to the specific case statements to clarify the error return paths. Fix also saves 50 bytes. Before: text data bss dec hex filename 21418 4936 128 26482 6772 drivers/iio/adc/ina2xx-adc.o After: dec hex filename 21370 4936 128 26434 6742 drivers/iio/adc/ina2xx-adc.o (gcc 8.2, x86-64) Detected by CoverityScan, CID#1462408 ("Missing break in switch") Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Stefan BrĂ¼ns <stefan.bruens@rwth-aachen.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/adc/ina2xx-adc.c')
-rw-r--r--drivers/iio/adc/ina2xx-adc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c
index d1239624187d..bdd7cba6f6b0 100644
--- a/drivers/iio/adc/ina2xx-adc.c
+++ b/drivers/iio/adc/ina2xx-adc.c
@@ -250,6 +250,7 @@ static int ina2xx_read_raw(struct iio_dev *indio_dev,
*val2 = chip->shunt_resistor_uohm;
return IIO_VAL_FRACTIONAL;
}
+ return -EINVAL;
case IIO_CHAN_INFO_HARDWAREGAIN:
switch (chan->address) {
@@ -262,6 +263,7 @@ static int ina2xx_read_raw(struct iio_dev *indio_dev,
*val = chip->range_vbus == 32 ? 1 : 2;
return IIO_VAL_INT;
}
+ return -EINVAL;
}
return -EINVAL;