From: Colin Ian King Date: Tue, 16 Oct 2018 16:14:18 +0000 (+0100) Subject: iio: adc: ina2xx: add in early -EINVAL returns in case statements X-Git-Tag: v5.4-rc1~1925^2~249^2~65 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d42282db6c41cd1896090c3bc95fc9cfd7268189;p=platform%2Fkernel%2Flinux-rpi.git 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 Reviewed-by: Stefan BrĂ¼ns Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c index d123962..bdd7cba 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;