[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191108105213.GR10409@kadam>
Date: Fri, 8 Nov 2019 13:53:19 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Beniamin Bia <beniamin.bia@...log.com>
Cc: jic23@...nel.org, devel@...verdev.osuosl.org, mark.rutland@....com,
lars@...afoo.de, biabeniamin@...look.com,
Michael.Hennerich@...log.com, devicetree@...r.kernel.org,
linux-iio@...r.kernel.org, gregkh@...uxfoundation.org,
linus.walleij@...aro.org, linux-kernel@...r.kernel.org,
nicolas.ferre@...rochip.com, robh+dt@...nel.org, pmeerw@...erw.net,
mchehab+samsung@...nel.org, paulmck@...ux.ibm.com,
Paul Cercueil <paul.cercueil@...log.com>
Subject: Re: [PATCH v3 1/4] iio: adc: Add support for AD7091R5 ADC
On Thu, Nov 07, 2019 at 05:07:56PM +0200, Beniamin Bia wrote:
> +static int ad7091r_set_mode(struct ad7091r_state *st, enum ad7091r_mode mode)
> +{
> + int ret, conf;
> +
> + switch (mode) {
> + case AD7091R_MODE_SAMPLE:
> + conf = 0;
> + break;
> + case AD7091R_MODE_COMMAND:
> + conf = AD7091R_REG_CONF_CMD;
> + break;
> + case AD7091R_MODE_AUTOCYCLE:
> + conf = AD7091R_REG_CONF_AUTO;
> + break;
> + default:
> + ret = -EINVAL;
> + break;
return -EINVAL;
> + }
> +
> + ret = regmap_update_bits(st->map, AD7091R_REG_CONF,
> + AD7091R_REG_CONF_MODE_MASK, conf);
otherwise conf is uninitialized.
> + if (ret)
> + return ret;
> +
> + st->mode = mode;
> +
> + return ret;
return 0;
> +}
> +
> +static int ad7091r_set_channel(struct ad7091r_state *st, unsigned int channel)
> +{
> + unsigned int foo;
Use unsigned int dummy.
> + int ret;
> +
Otherwise it looks ok to me. (Not a domain expert).
regards,
dan carpenter
Powered by blists - more mailing lists