[PATCH 5/6] power: regulator: tps65910: Cannot test unsigned for being negative

Frieder Schrempf frieder.schrempf at kontron.de
Wed Aug 27 09:54:53 CEST 2025


Am 07.08.25 um 18:35 schrieb Andrew Goodbody:
> The code in tps65910_regulator.c treats the field supply in struct
> tps65910_regulator_pdata as an int and even tests the value for being
> negative so change it from a u32 to int so that the code all works as
> expected.

I'm not sure if this is the best solution. The supply field holds a
voltage value in uV and u32 seems like a reasonable type to use.

I would argue that the driver should be changed to not use int and
remove the negative value check.

> 
> This issue was found by Smatch.
> 
> Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
> ---
>  include/power/tps65910_pmic.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/power/tps65910_pmic.h b/include/power/tps65910_pmic.h
> index 2026ec2f426..8fa02f33ab1 100644
> --- a/include/power/tps65910_pmic.h
> +++ b/include/power/tps65910_pmic.h
> @@ -123,7 +123,7 @@ enum {
>  
>  /* platform data */
>  struct tps65910_regulator_pdata {
> -	u32 supply;	/* regulator supply voltage in uV */
> +	int supply;	/* regulator supply voltage in uV */
>  	uint unit;	/* unit-address according to DT */
>  };
>  
> 



More information about the U-Boot mailing list