Re: [PATCH v2 2/5] memory: stm32-fmc2-ebi: check regmap_read return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 19/02/2024 15:01, Christophe Kerello wrote:
> Check regmap_read return value to avoid to use uninitialized local
> variables.
> 
> Signed-off-by: Christophe Kerello <christophe.kerello@xxxxxxxxxxx>
> ---
> Changes in v2:
>  - New patch added
> 
>  drivers/memory/stm32-fmc2-ebi.c | 128 +++++++++++++++++++++++---------
>  1 file changed, 94 insertions(+), 34 deletions(-)
> 

...

> -static void stm32_fmc2_ebi_save_setup(struct stm32_fmc2_ebi *ebi)
> +static int stm32_fmc2_ebi_save_setup(struct stm32_fmc2_ebi *ebi)
>  {
>  	unsigned int cs;
> +	int ret;
>  
>  	for (cs = 0; cs < FMC2_MAX_EBI_CE; cs++) {
> -		regmap_read(ebi->regmap, FMC2_BCR(cs), &ebi->bcr[cs]);
> -		regmap_read(ebi->regmap, FMC2_BTR(cs), &ebi->btr[cs]);
> -		regmap_read(ebi->regmap, FMC2_BWTR(cs), &ebi->bwtr[cs]);
> +		ret = regmap_read(ebi->regmap, FMC2_BCR(cs), &ebi->bcr[cs]);
> +		if (ret)
> +			return ret;
> +
> +		ret = regmap_read(ebi->regmap, FMC2_BTR(cs), &ebi->btr[cs]);
> +		if (ret)
> +			return ret;
> +
> +		ret = regmap_read(ebi->regmap, FMC2_BWTR(cs), &ebi->bwtr[cs]);
> +		if (ret)
> +			return ret;

These are just:

ret |= regmapr_read()
and one "if (ret)" clause.



Best regards,
Krzysztof





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux