summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Goodbody <[email protected]>2025-08-07 17:35:20 +0100
committerTom Rini <[email protected]>2025-08-29 16:45:19 -0600
commit96312ed79630838b09368c8c07ec164fd40a025c (patch)
treeebc40175acef719011ecd68fc2f09c9066a3a094
parent8f90028ccdbfc74487c4b40bd6fe5d34c3309b7a (diff)
power: regulator: palmas: Cannot test unsigned for being negative
In palmas_smps_val and palmas_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 <[email protected]> Reviewed-by: Frieder Schrempf <[email protected]>
-rw-r--r--drivers/power/regulator/palmas_regulator.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/power/regulator/palmas_regulator.c b/drivers/power/regulator/palmas_regulator.c
index 2286eac93fb..7212062c8c8 100644
--- a/drivers/power/regulator/palmas_regulator.c
+++ b/drivers/power/regulator/palmas_regulator.c
@@ -115,8 +115,8 @@ static int palmas_smps_hex2volt(int hex, bool range)
static int palmas_smps_val(struct udevice *dev, int op, int *uV)
{
- unsigned int hex, adr;
- int ret;
+ unsigned int adr;
+ int hex, ret;
bool range;
struct dm_regulator_uclass_plat *uc_pdata;
@@ -251,8 +251,8 @@ static int palmas_ldo_hex2volt(int hex)
static int palmas_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;