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 <andrew.goodbody@linaro.org>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
This commit is contained in:
Andrew Goodbody 2025-08-07 17:35:20 +01:00 committed by Tom Rini
parent 8f90028ccd
commit 96312ed796

View File

@ -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) static int palmas_smps_val(struct udevice *dev, int op, int *uV)
{ {
unsigned int hex, adr; unsigned int adr;
int ret; int hex, ret;
bool range; bool range;
struct dm_regulator_uclass_plat *uc_pdata; 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) static int palmas_ldo_val(struct udevice *dev, int op, int *uV)
{ {
unsigned int hex, adr; unsigned int adr;
int ret; int hex, ret;
struct dm_regulator_uclass_plat *uc_pdata; struct dm_regulator_uclass_plat *uc_pdata;