[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1c4ab974-2b72-45ce-ab20-de158b91e356@linaro.org>
Date: Wed, 21 Feb 2024 09:29:28 +0100
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: Christophe Kerello <christophe.kerello@...s.st.com>, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org
Cc: linux-kernel@...r.kernel.org, linux-stm32@...md-mailman.stormreply.com,
devicetree@...r.kernel.org
Subject: Re: [PATCH v2 2/5] memory: stm32-fmc2-ebi: check regmap_read return
value
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@...s.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.
Best regards,
Krzysztof
Powered by blists - more mailing lists