From: Jonathan Cameron <jic23@kernel.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Wei Yongjun <yongjun_wei@trendmicro.com.cn>,
Sachin Kamat <sachin.kamat@linaro.org>,
linux-iio@vger.kernel.org, devel@driverdev.osuosl.org,
kernel-janitors@vger.kernel.org
Subject: Re: [patch] staging: iio/ad7291: fix error code in ad7291_probe()
Date: Sat, 21 Jun 2014 11:37:35 +0100 [thread overview]
Message-ID: <53A5606F.8000103@kernel.org> (raw)
In-Reply-To: <20140620192234.GD19824@mwanda>
On 20/06/14 20:22, Dan Carpenter wrote:
> We should be returning a negative error code instead of success here.
>
> This would have been detected by GCC, except that the "ret" variable was
> initialized with a bogus value to disable GCC's uninitialized variable
> warnings. I've cleaned that up, as well.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied to the fixes-togreg branch of iio.git and cc'd to stable.
Thanks,
Jonathan
>
> diff --git a/drivers/staging/iio/adc/ad7291.c b/drivers/staging/iio/adc/ad7291.c
> index 357cef2..7194bd1 100644
> --- a/drivers/staging/iio/adc/ad7291.c
> +++ b/drivers/staging/iio/adc/ad7291.c
> @@ -465,7 +465,7 @@ static int ad7291_probe(struct i2c_client *client,
> struct ad7291_platform_data *pdata = client->dev.platform_data;
> struct ad7291_chip_info *chip;
> struct iio_dev *indio_dev;
> - int ret = 0;
> + int ret;
>
> indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip));
> if (!indio_dev)
> @@ -475,7 +475,7 @@ static int ad7291_probe(struct i2c_client *client,
> if (pdata && pdata->use_external_ref) {
> chip->reg = devm_regulator_get(&client->dev, "vref");
> if (IS_ERR(chip->reg))
> - return ret;
> + return PTR_ERR(chip->reg);
>
> ret = regulator_enable(chip->reg);
> if (ret)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
prev parent reply other threads:[~2014-06-21 10:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-20 19:22 [patch] staging: iio/ad7291: fix error code in ad7291_probe() Dan Carpenter
2014-06-21 10:37 ` 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=53A5606F.8000103@kernel.org \
--to=jic23@kernel.org \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=sachin.kamat@linaro.org \
--cc=yongjun_wei@trendmicro.com.cn \
/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).