public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Mark Brown" <broonie@kernel.org>, "Arnd Bergmann" <arnd@kernel.org>
Cc: "Tony Lindgren" <tony@atomide.com>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Jerome Neanne" <jneanne@baylibre.com>,
	"Axel Lin" <axel.lin@ingics.com>,
	"Yang Li" <yang.lee@linux.alibaba.com>,
	"Yang Yingliang" <yangyingliang@huawei.com>,
	Linux-OMAP <linux-omap@vger.kernel.org>,
	linux-kernel@vger.kernel.org,
	"Randy Dunlap" <rdunlap@infradead.org>
Subject: Re: [PATCH] regulator: tps65219: fix Wextra warning
Date: Thu, 19 Jan 2023 09:07:38 +0100	[thread overview]
Message-ID: <b1f98c2a-3087-464e-b9fb-97e7c78cfdab@app.fastmail.com> (raw)
In-Reply-To: <67efe55d-e5cd-46c1-97e4-c9f3a5884a07@app.fastmail.com>

On Fri, Dec 16, 2022, at 11:18, Arnd Bergmann wrote:
> On Thu, Dec 15, 2022, at 17:48, Mark Brown wrote:
>> On Thu, Dec 15, 2022 at 05:41:28PM +0100, Arnd Bergmann wrote:
>>
>>> -		tps65219_get_rdev_by_name(irq_type->regulator_name, rdevtbl, rdev);
>>> -		if (rdev < 0) {
>>> +		error = tps65219_get_rdev_by_name(irq_type->regulator_name, rdevtbl, rdev);
>>> +		if (error) {
>>>  			dev_err(tps->dev, "Failed to get rdev for %s\n",
>>>  				irq_type->regulator_name);
>>> -			return -EINVAL;
>>> +			return error;
>>
>> This will shut up the warning but is leaving the use of the
>> uninitialised rdev (which I'm kind of disappointed the static checkers
>> didn't pick up on).  rdev needs to be passed by reference into the
>> function, or set from the return value.
>
> Right, I didn't look far enough to see what the function is
> actually trying to do here, and that it completely fails to
> do that.
>
> I see that the bug was introduced between the first [1] and
> second []2] version of the driver, but don't see why. I'll
> leave it up to Jerome to address the problem, he's still
> in the middle of posting the rest of the series that has
> not yet been merged, so it makes sense for him to test it
> all together.
>
>     Arnd
>
> [1] https://lore.kernel.org/lkml/20220719091742.3221-9-jneanne@baylibre.com/
> [2] https://lore.kernel.org/lkml/20220726103355.17684-10-jneanne@baylibre.com/

It looks like you merged another workaround from Randy Dunlap now as
commit 2bbba115c3c9 ("regulator: tps65219: use IS_ERR() to detect an error
pointer"), but I think that one is just as wrong as the one I submitted:
the 'rdev' variable still remains uninitialized, and checking its value
after it has already been used is not helpful.

      Arnd

  reply	other threads:[~2023-01-19  8:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15 16:41 [PATCH] regulator: tps65219: fix Wextra warning Arnd Bergmann
2022-12-15 16:48 ` Mark Brown
2022-12-16 10:18   ` Arnd Bergmann
2023-01-19  8:07     ` Arnd Bergmann [this message]
2023-01-19 11:13       ` Mark Brown

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=b1f98c2a-3087-464e-b9fb-97e7c78cfdab@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=axel.lin@ingics.com \
    --cc=broonie@kernel.org \
    --cc=jneanne@baylibre.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=tony@atomide.com \
    --cc=yang.lee@linux.alibaba.com \
    --cc=yangyingliang@huawei.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