DriverDev-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Beniamin Bia <beniamin.bia@analog.com>
Cc: devel@driverdev.osuosl.org, mark.rutland@arm.com,
	lars@metafoo.de, biabeniamin@outlook.com,
	Michael.Hennerich@analog.com, devicetree@vger.kernel.org,
	linux-iio@vger.kernel.org, gregkh@linuxfoundation.org,
	linus.walleij@linaro.org, linux-kernel@vger.kernel.org,
	nicolas.ferre@microchip.com, robh+dt@kernel.org,
	pmeerw@pmeerw.net, mchehab+samsung@kernel.org,
	paulmck@linux.ibm.com, Paul Cercueil <paul.cercueil@analog.com>,
	jic23@kernel.org
Subject: Re: [PATCH v3 1/4] iio: adc: Add support for AD7091R5 ADC
Date: Fri, 8 Nov 2019 13:53:19 +0300
Message-ID: <20191108105213.GR10409@kadam> (raw)
In-Reply-To: <20191107150759.5937-1-beniamin.bia@analog.com>

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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  parent reply index

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-07 15:07 Beniamin Bia
2019-11-07 15:07 ` [PATCH v3 2/4] iio: adc: ad7091r5: Add scale and external VREF support Beniamin Bia
2019-11-10 15:54   ` Jonathan Cameron
2019-11-07 15:07 ` [PATCH v3 3/4] dt-binding: iio: Add documentation for AD7091R5 Beniamin Bia
2019-11-14  1:29   ` Rob Herring
2019-11-07 15:07 ` [PATCH v3 4/4] MAINTAINERS: add entry for AD7091R5 driver Beniamin Bia
2019-11-08 10:53 ` Dan Carpenter [this message]
2019-11-10 15:48 ` [PATCH v3 1/4] iio: adc: Add support for AD7091R5 ADC Jonathan Cameron

Reply instructions:

You may reply publically 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=20191108105213.GR10409@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=beniamin.bia@analog.com \
    --cc=biabeniamin@outlook.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mchehab+samsung@kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=paul.cercueil@analog.com \
    --cc=paulmck@linux.ibm.com \
    --cc=pmeerw@pmeerw.net \
    --cc=robh+dt@kernel.org \
    /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

DriverDev-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/driverdev-devel/0 driverdev-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 driverdev-devel driverdev-devel/ https://lore.kernel.org/driverdev-devel \
		driverdev-devel@linuxdriverproject.org devel@driverdev.osuosl.org
	public-inbox-index driverdev-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.linuxdriverproject.driverdev-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git