public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: sanjeev sharma <sanjeevsharmaengg@gmail.com>,
	Devendra Naga <devendra.aaru@gmail.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-iio@vger.kernel.org, devel <devel@driverdev.osuosl.org>
Subject: Re: [PATCH V2 1/2] iio: meter: ade7754: add error handling in _reset and _stop_device
Date: Sun, 01 Feb 2015 10:05:43 +0000	[thread overview]
Message-ID: <54CDFA77.1060701@kernel.org> (raw)
In-Reply-To: <CAGUYZuTsV1x+tsQpm-yeuXfM9XVT7it9Nj8rzxqCaVOVmND7Jw@mail.gmail.com>

On 05/01/15 05:57, sanjeev sharma wrote:
> On Fri, Jan 2, 2015 at 2:32 PM, Devendra Naga <devendra.aaru@gmail.com> wrote:
>> This patch adds the error handling for the value returned from
>> ade7754_spi_read_reg_8. With this patch, the following randconfig
>> warnings get fixed automatically.
>>
>> drivers/staging/iio/meter/ade7754.c:222:6: warning: ‘val’ may be used
>> uninitialized in this function [-Wmaybe-uninitialized]
>> drivers/staging/iio/meter/ade7754.c:368:6: warning: ‘val’ may be used
>> uninitialized in this function [-Wmaybe-uninitialized]
>>
>> Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
>> ---
>>
>>  Hello,
>>
>>  Please see if this is the error message you wanted.
>>
>>  Build tested on next-20141231 with randconfig sent to iio ml,
>>  and with allmodconfig.
>>
>>  drivers/staging/iio/meter/ade7754.c | 15 +++++++++++++--
>>  1 file changed, 13 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/staging/iio/meter/ade7754.c b/drivers/staging/iio/meter/ade7754.c
>> index 81f6731..746b188 100644
>> --- a/drivers/staging/iio/meter/ade7754.c
>> +++ b/drivers/staging/iio/meter/ade7754.c
>> @@ -216,9 +216,13 @@ error_ret:
>>
>>  static int ade7754_reset(struct device *dev)
>>  {
>> +       int ret;
>>         u8 val;
>>
>> -       ade7754_spi_read_reg_8(dev, ADE7754_OPMODE, &val);
>> +       ret = ade7754_spi_read_reg_8(dev, ADE7754_OPMODE, &val);
>> +       if (ret < 0)
> 
> IMO,we should have consistent change throughout and here also we
> should use dev_err in failure scenario.
That would perhaps be an additional improvement, but the patch as it
stands is still a good thing so applied.  Feel free to follow up
with additional debugging information.

>> +               return ret;
>> +
>>         val |= 1 << 6; /* Software Chip Reset */
>>         return ade7754_spi_write_reg_8(dev, ADE7754_OPMODE, val);
>>  }
>> @@ -362,9 +366,16 @@ error_ret:
>>  /* Power down the device */
>>  static int ade7754_stop_device(struct device *dev)
>>  {
>> +       int ret;
>>         u8 val;
>>
>> -       ade7754_spi_read_reg_8(dev, ADE7754_OPMODE, &val);
>> +       ret = ade7754_spi_read_reg_8(dev, ADE7754_OPMODE, &val);
>> +       if (ret < 0) {
>> +               dev_err(dev, "unable to power down the device, error: %d",
>> +                       ret);
>> +               return ret;
>> +       }
>> +
>>         val |= 7 << 3;  /* ADE7754 powered down */
>>         return ade7754_spi_write_reg_8(dev, ADE7754_OPMODE, val);
>>  }
>> --
>> 1.9.3
>>
>> _______________________________________________
>> devel mailing list
>> devel@linuxdriverproject.org
>> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
> --
> 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
> 


      reply	other threads:[~2015-02-01 10:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-02  9:02 [PATCH V2 1/2] iio: meter: ade7754: add error handling in _reset and _stop_device Devendra Naga
2015-01-02  9:02 ` [PATCH V2 2/2] iio: meter: ade7759: " Devendra Naga
2015-02-01 10:10   ` Jonathan Cameron
2015-01-04 11:06 ` [PATCH V2 1/2] iio: meter: ade7754: " Jonathan Cameron
2015-01-05  6:12   ` devendra.aaru
2015-02-01 10:02     ` Jonathan Cameron
2015-01-05  5:57 ` sanjeev sharma
2015-02-01 10:05   ` 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=54CDFA77.1060701@kernel.org \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=devendra.aaru@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=sanjeevsharmaengg@gmail.com \
    /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