mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Christophe Kerello <christophe.kerello@foss.st.com>,
	robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	conor+dt@kernel.org
Cc: linux-kernel@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v2 2/5] memory: stm32-fmc2-ebi: check regmap_read return value
Date: Wed, 21 Feb 2024 09:29:28 +0100	[thread overview]
Message-ID: <1c4ab974-2b72-45ce-ab20-de158b91e356@linaro.org> (raw)
In-Reply-To: <20240219140202.85680-3-christophe.kerello@foss.st.com>

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@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.



Best regards,
Krzysztof


  reply	other threads:[~2024-02-21  8:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-19 14:01 [PATCH v2 0/5] memory: stm32-fmc2-ebi: Add MP25 FMC2 support Christophe Kerello
2024-02-19 14:01 ` [PATCH v2 1/5] dt-bindings: memory-controller: st,stm32: add MP25 support Christophe Kerello
2024-02-20  9:56   ` Krzysztof Kozlowski
2024-02-21  8:27     ` Krzysztof Kozlowski
2024-02-19 14:01 ` [PATCH v2 2/5] memory: stm32-fmc2-ebi: check regmap_read return value Christophe Kerello
2024-02-21  8:29   ` Krzysztof Kozlowski [this message]
2024-02-26  8:25     ` Christophe Kerello
2024-02-19 14:02 ` [PATCH v2 3/5] memory: stm32-fmc2-ebi: add MP25 support Christophe Kerello
2024-02-21  8:32   ` Krzysztof Kozlowski
2024-02-26  8:26     ` Christophe Kerello
2024-02-19 14:02 ` [PATCH v2 4/5] memory: stm32-fmc2-ebi: add MP25 RIF support Christophe Kerello
2024-02-19 14:02 ` [PATCH v2 5/5] memory: stm32-fmc2-ebi: keep power domain on Christophe Kerello

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1c4ab974-2b72-45ce-ab20-de158b91e356@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=christophe.kerello@foss.st.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®