]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
power: regulator: lp87565: Cannot test unsigned for being negative
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Thu, 7 Aug 2025 16:35:19 +0000 (17:35 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 29 Aug 2025 22:45:19 +0000 (16:45 -0600)
In lp87565_buck_val hex is an unsigned variable being assigned the return
value from a function that returns int. Change hex to be an int so that
the following test for an error as a negative value will work as expected.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
drivers/power/regulator/lp87565_regulator.c

index 2212cb5c651bc0ecece55d78746a52e0b5050bbf..ea9c7685e9fc555cff636d9882de4a04a48a1306 100644 (file)
@@ -82,8 +82,8 @@ static int lp87565_buck_val2volt(int val)
 
 static int lp87565_buck_val(struct udevice *dev, int op, int *uV)
 {
-       unsigned int hex, adr;
-       int ret;
+       unsigned int adr;
+       int hex, ret;
        struct dm_regulator_uclass_plat *uc_pdata;
 
        uc_pdata = dev_get_uclass_plat(dev);