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.goodb...@linaro.org>
---
 drivers/power/regulator/lp873x_regulator.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/power/regulator/lp873x_regulator.c 
b/drivers/power/regulator/lp873x_regulator.c
index 271a7e45139..62d91a23f77 100644
--- a/drivers/power/regulator/lp873x_regulator.c
+++ b/drivers/power/regulator/lp873x_regulator.c
@@ -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;
 

-- 
2.39.5

Reply via email to