From: Sebastian Reichel Date: Sun, 6 Jul 2025 23:26:58 +0000 (+0200) Subject: power: supply: core: fix static checker warning X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7b41a2341fa62babda5d5c7a32c632e9eba2ee11;p=thirdparty%2Fkernel%2Flinux.git power: supply: core: fix static checker warning 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 Closes: https://lore.kernel.org/linux-pm/285c9c39-482c-480c-8b0b-07111e39fdfe@sabinyo.mountain/ Reviewed-by: Hans de Goede Link: https://lore.kernel.org/r/20250707-fix-psy-static-checker-warning-v1-1-42d555c2b68a@collabora.com Signed-off-by: Sebastian Reichel --- diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index aedb20c1d2767..7c3913155dc0b 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; }