public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Fengguang Wu <fengguang.wu@intel.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [leds:for-next 18/18] drivers/leds/leds-lm3530.c:432 lm3530_probe() info: why not propagate 'err
Date: Wed, 12 Sep 2012 04:55:04 +0000	[thread overview]
Message-ID: <20120912045504.GA23209@localhost> (raw)
In-Reply-To: <20120912042018.GA22810@localhost>

On Wed, Sep 12, 2012 at 10:17:55AM +0530, Sachin Kamat wrote:
> Hi Fengguang,
> 
> On 12 September 2012 10:02, Fengguang Wu <fengguang.wu@intel.com> wrote:
> > Hi Sachin,
> >
> > On Wed, Sep 12, 2012 at 09:59:38AM +0530, Sachin Kamat wrote:
> >> Hi Fengguang,
> >>
> >> Thanks for bringing this to my notice. I compile tested this patch
> >> using the latest (11 Sep 2012) linux-next tree.
> >> Unfortunately I cannot not understand the meaning of these smatch warnings.
> >> Could you please simplify them for me?
> >
> > I think the warnings can be quieted by
> >
> > -                         return -ENODEV;
> > +                         return err;
> >
> 
> The original code was something like this:
> 
>                 err = -ENODEV;
>                 return err;
> 
> which i simplified to (as a result of using devm_*)
>                 return -ENODEV;
> 
> Hence technically i don't think I changed anything. Do you want me to
> revert this change back?

I think the intention of the warning is that the err value from
lm3530_init_registers() can be directly returned, like this:

                  err = lm3530_init_registers(drvdata);
                  if (err < 0) {
                          dev_err(&client->dev,
                                  "Register Init failed: %d\n", err);
-                         return -ENODEV;
+                         return err;
                  }

That will remove the assumption that lm3530_init_registers() always
returns -ENODEV on error.

Thanks,
Fengguang

> >> On 12 September 2012 09:50, Fengguang Wu <fengguang.wu@intel.com> wrote:
> >> > Hi Sachin,
> >> >
> >> > FYI, there are new smatch warnings show up in
> >> >
> >> > tree:   git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds.git for-next
> >> > head:   2829515a5fb5ceccb4021d819c3d7d0ecaab86eb
> >> > commit: 2829515a5fb5ceccb4021d819c3d7d0ecaab86eb [18/18] leds-lm3530: Use devm_regulator_get function
> >> >
> >> > All smatch warnings:
> >> >
> >> >   drivers/leds/leds-lm3530.c:361 lm3530_mode_set() info: why not propagate 'mode' from lm3530_get_mode_from_str() instead of -22?
> >> > + drivers/leds/leds-lm3530.c:432 lm3530_probe() info: why not propagate 'err' from lm3530_init_registers() instead of -19?
> >> > + drivers/leds/leds-lm3530.c:438 lm3530_probe() info: why not propagate 'err' from led_classdev_register() instead of -19?
> >> >
> >> > vim +432 drivers/leds/leds-lm3530.c
> >> >    422                  err = PTR_ERR(drvdata->regulator);
> >> >    423                  drvdata->regulator = NULL;
> >> >    424                  return err;
> >> >    425          }
> >> >    426
> >> >    427          if (drvdata->pdata->brt_val) {
> >> >    428                  err = lm3530_init_registers(drvdata);
> >> >    429                  if (err < 0) {
> >> >    430                          dev_err(&client->dev,
> >> >    431                                  "Register Init failed: %d\n", err);
> >> >  > 432                          return -ENODEV;
> >> >    433                  }
> >> >    434          }
> >> >    435          err = led_classdev_register(&client->dev, &drvdata->led_dev);
> >> >    436          if (err < 0) {
> >> >    437                  dev_err(&client->dev, "Register led class failed: %d\n", err);
> >> >    438                  return -ENODEV;
> >> >    439          }
> >> >    440
> >> >    441          err = device_create_file(drvdata->led_dev.dev, &dev_attr_mode);
> >> >    442          if (err < 0) {
> >> >
> >> > ---
> >> > 0-DAY kernel build testing backend         Open Source Technology Centre
> >> > Fengguang Wu <wfg@linux.intel.com>                     Intel Corporation
> >>
> >>
> >>
> >> --
> >> With warm regards,
> >> Sachin
> 
> 
> 
> -- 
> With warm regards,
> Sachin

  parent reply	other threads:[~2012-09-12  4:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-12  4:20 [leds:for-next 18/18] drivers/leds/leds-lm3530.c:432 lm3530_probe() info: why not propagate 'err' fr Fengguang Wu
2012-09-12  4:32 ` [leds:for-next 18/18] drivers/leds/leds-lm3530.c:432 lm3530_probe() info: why not propagate 'err Fengguang Wu
2012-09-12  4:41 ` Sachin Kamat
2012-09-12  4:55 ` Fengguang Wu [this message]
2012-09-12  4:59 ` Sachin Kamat
2012-09-12  5:24 ` Fengguang Wu
2012-09-12  5:30 ` Sachin Kamat
2012-09-12  5:46 ` Bryan Wu
2012-09-12  5:52 ` Sachin Kamat

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=20120912045504.GA23209@localhost \
    --to=fengguang.wu@intel.com \
    --cc=kernel-janitors@vger.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
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