linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: "Stefan Brüns" <stefan.bruens@rwth-aachen.de>
Cc: Colin King <colin.king@canonical.com>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	<linux-iio@vger.kernel.org>, <kernel-janitors@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][V2] iio: adc: ina2xx: add in early -EINVAL returns in case statements
Date: Sun, 21 Oct 2018 15:45:03 +0100	[thread overview]
Message-ID: <20181021154503.5141163f@archlinux> (raw)
In-Reply-To: <3078823.PklSZE2rHu@pebbles>

On Tue, 16 Oct 2018 20:26:57 +0200
Stefan Br=C3=BCns <stefan.bruens@rwth-aachen.de> wrote:

> On Dienstag, 16. Oktober 2018 18:14:18 CEST Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> >=20
> > 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.
> >=20
> > Before:
> >    text	   data	    bss	    dec	    hex	filename
> >   21418	   4936	    128	  26482	   6772	drivers/iio/adc/ina2xx-adc.o
> >=20
> > After:
> >   dec	    hex	filename
> >   21370	   4936	    128	  26434	   6742	drivers/iio/adc/ina2xx-adc.o
> >=20
> > (gcc 8.2, x86-64)
> >=20
> > Detected by CoverityScan, CID#1462408 ("Missing break in switch")
> >=20
> > ---
> >=20
> > V2: use returns instead of break statements to keep with the
> > current style used in the switch statement.
> >=20
> > Signed-off-by: Colin Ian King <colin.king@canonical.com> =20
>=20
> Reviewed-by: Stefan Br=C3=BCns <stefan.bruens@rwth-aachen.de>

Thanks, and applied to the togreg branch of iio.git and pushed
out as testing for the autobuilders to play with it.

Note however that I was confused when there appeared to be no sign off
in the patch from Colin after applying.  It ended up below an
additional cut line so git am dropped it.

All fixed up now.

Thanks,

Jonathan

>=20
> > ---
> >  drivers/iio/adc/ina2xx-adc.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >=20
> > 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_de=
v,
> >  			*val2 =3D chip->shunt_resistor_uohm;
> >  			return IIO_VAL_FRACTIONAL;
> >  		}
> > +		return -EINVAL;
> >=20
> >  	case IIO_CHAN_INFO_HARDWAREGAIN:
> >  		switch (chan->address) {
> > @@ -262,6 +263,7 @@ static int ina2xx_read_raw(struct iio_dev *indio_de=
v,
> >  			*val =3D chip->range_vbus =3D=3D 32 ? 1 : 2;
> >  			return IIO_VAL_INT;
> >  		}
> > +		return -EINVAL;
> >  	}
> >=20
> >  	return -EINVAL; =20
>=20
>=20

      reply	other threads:[~2018-10-21 22:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-16 16:14 [PATCH][V2] iio: adc: ina2xx: add in early -EINVAL returns in case statements Colin King
2018-10-16 18:26 ` Stefan Brüns
2018-10-21 14:45   ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181021154503.5141163f@archlinux \
    --to=jic23@kernel.org \
    --cc=colin.king@canonical.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=stefan.bruens@rwth-aachen.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).