mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] power: supply: core: fix static checker warning
@ 2025-07-06 23:26 Sebastian Reichel
  2025-07-07 10:04 ` Hans de Goede
  2025-07-12 18:47 ` Sebastian Reichel
  0 siblings, 2 replies; 3+ messages in thread
From: Sebastian Reichel @ 2025-07-06 23:26 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: AngeloGioacchino Del Regno, Hans de Goede, Dan Carpenter,
	linux-pm, linux-kernel, kernel, Sebastian Reichel

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>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-12 18:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-06 23:26 [PATCH] power: supply: core: fix static checker warning Sebastian Reichel
2025-07-07 10:04 ` Hans de Goede
2025-07-12 18:47 ` Sebastian Reichel

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®