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

index 13f94b730d4c405ad3ef90c2d32986d97bcdfeef..2561d6f4c6cc69c091b6dc6c8efcf62931cd0936 100644 (file)
@@ -277,8 +277,8 @@ static const struct tps65941_reg_conv_ops buck_conv_ops[] = {
 
 static int tps65941_buck_val(struct udevice *dev, int op, int *uV)
 {
-       unsigned int hex, adr;
-       int ret, delta, uwait, slew, idx;
+       unsigned int adr;
+       int hex, ret, delta, uwait, slew, idx;
        struct dm_regulator_uclass_plat *uc_pdata;
        const struct tps65941_reg_conv_ops *conv_ops;
        ulong chip_id;
@@ -479,8 +479,8 @@ static const struct tps65941_reg_conv_ops ldo_conv_ops[] = {
 
 static int tps65941_ldo_val(struct udevice *dev, int op, int *uV)
 {
-       unsigned int hex, adr;
-       int ret, ret_volt, idx, ldo_bypass;
+       unsigned int adr;
+       int hex, ret, ret_volt, idx, ldo_bypass;
        struct dm_regulator_uclass_plat *uc_pdata;
        const struct tps65941_reg_conv_ops *conv_ops;
        ulong chip_id;