mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Sebastian Reichel <sre@kernel.org>
Cc: AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	 Hans de Goede <hansg@kernel.org>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	 linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 kernel@collabora.com,
	Sebastian Reichel <sebastian.reichel@collabora.com>
Subject: [PATCH] power: supply: core: fix static checker warning
Date: Mon, 07 Jul 2025 01:26:58 +0200	[thread overview]
Message-ID: <20250707-fix-psy-static-checker-warning-v1-1-42d555c2b68a@collabora.com> (raw)

static checker complains, that the block already breaks if IS_ERR(np)
and thus the extra !IS_ERR(np) check in the while condition is
superfluous. Avoid the extra check by using while(true) instead. This
should not change the runtime behavior at all and I expect the binary
to be more or less the same for an optimizing compiler.

Fixes: f368f87b22da ("power: supply: core: convert to fwnnode")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/linux-pm/285c9c39-482c-480c-8b0b-07111e39fdfe@sabinyo.mountain/
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 drivers/power/supply/power_supply_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index aedb20c1d2767309ae716712f8be8002b988f1b4..7c3913155dc0b7e51cdefe2974b09a9259ccb4b9 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -212,7 +212,7 @@ static int __power_supply_populate_supplied_from(struct power_supply *epsy,
 			break;
 		}
 		fwnode_handle_put(np);
-	} while (!IS_ERR(np));
+	} while (true);
 
 	return 0;
 }

---
base-commit: f9335bb4f5d4f3b913efd5872c2794d027dd85a6
change-id: 20250707-fix-psy-static-checker-warning-f6aac00b24dd

Best regards,
-- 
Sebastian Reichel <sebastian.reichel@collabora.com>


             reply	other threads:[~2025-07-06 23:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-06 23:26 Sebastian Reichel [this message]
2025-07-07 10:04 ` Hans de Goede
2025-07-12 18:47 ` Sebastian Reichel

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=20250707-fix-psy-static-checker-warning-v1-1-42d555c2b68a@collabora.com \
    --to=sebastian.reichel@collabora.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=dan.carpenter@linaro.org \
    --cc=hansg@kernel.org \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sre@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

all inboxes | Powered by JetHome®