]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
power: regulator: lp873x: Cannot test unsigned for being negative
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Thu, 7 Aug 2025 16:35:18 +0000 (17:35 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 29 Aug 2025 22:45:19 +0000 (16:45 -0600)
In lp873x_buck_val and lp873x_ldo_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/lp873x_regulator.c

index 271a7e45139b0b7fb3ab5fd71c5406699a3fd855..62d91a23f7715f5a8147658d9ea27f958f28f8d1 100644 (file)
@@ -83,8 +83,8 @@ static int lp873x_buck_hex2volt(int hex)
 
 static int lp873x_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);
@@ -177,8 +177,8 @@ static int lp873x_ldo_hex2volt(int hex)
 
 static int lp873x_ldo_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;