public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Tony Lindgren <tony@atomide.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Jerome Neanne <jneanne@baylibre.com>
Cc: Arnd Bergmann <arnd@arndb.de>, Axel Lin <axel.lin@ingics.com>,
	Yang Li <yang.lee@linux.alibaba.com>,
	Yang Yingliang <yangyingliang@huawei.com>,
	linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] regulator: tps65219: fix Wextra warning
Date: Thu, 15 Dec 2022 17:41:28 +0100	[thread overview]
Message-ID: <20221215164140.821796-1-arnd@kernel.org> (raw)

From: Arnd Bergmann <arnd@arndb.de>

gcc warns about an invalid pointer comparison when building with
-Wextra enabled:

drivers/regulator/tps65219-regulator.c: In function 'tps65219_regulator_probe':
drivers/regulator/tps65219-regulator.c:370:26: error: ordered comparison of pointer with integer zero [-Werror=extra]
  370 |                 if (rdev < 0) {
      |                          ^

It appears that the intention here was to check for an error code, rather
than the pointer, so adapt the code to propagate the error from the
called function instead.

Fixes: c12ac5fc3e0a ("regulator: drivers: Add TI TPS65219 PMIC regulators support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/regulator/tps65219-regulator.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/tps65219-regulator.c b/drivers/regulator/tps65219-regulator.c
index c484c943e467..fea3998334b1 100644
--- a/drivers/regulator/tps65219-regulator.c
+++ b/drivers/regulator/tps65219-regulator.c
@@ -366,11 +366,11 @@ static int tps65219_regulator_probe(struct platform_device *pdev)
 		irq_data[i].dev = tps->dev;
 		irq_data[i].type = irq_type;
 
-		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;
 		}
 		irq_data[i].rdev = rdev;
 
-- 
2.35.1


             reply	other threads:[~2022-12-15 16:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15 16:41 Arnd Bergmann [this message]
2022-12-15 16:48 ` [PATCH] regulator: tps65219: fix Wextra warning Mark Brown
2022-12-16 10:18   ` Arnd Bergmann
2023-01-19  8:07     ` Arnd Bergmann
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=20221215164140.821796-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=arnd@arndb.de \
    --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=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