From 42f959d0b091b779f235d7d0e54a794d4d857917 Mon Sep 17 00:00:00 2001 From: Andrew Goodbody Date: Thu, 7 Aug 2025 17:35:18 +0100 Subject: [PATCH] power: regulator: lp873x: Cannot test unsigned for being negative 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 Reviewed-by: Frieder Schrempf --- 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.47.3