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

Christophe Kerello christophe.kerello at foss.st.com
Mon Feb 26 08:25:02 UTC 2024


Hi Krzysztof,

On 2/21/24 09:29, Krzysztof Kozlowski wrote:
> 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 at foss.st.com>
>> ---
>> 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.
> 

Ok, it will be done in V3.

Regards,
Christophe Kerello.

> 
> 
> Best regards,
> Krzysztof
> 



More information about the Linux-stm32 mailing list