mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Anson Huang <Anson.Huang@nxp.com>,
	shawnguo@kernel.org, s.hauer@pengutronix.de,
	kernel@pengutronix.de, festevam@gmail.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: Linux-imx@nxp.com
Subject: Re: [PATCH] nvmem: imx-ocotp: Improve logic to save many code lines
Date: Fri, 17 Apr 2020 13:17:31 +0100	[thread overview]
Message-ID: <9794030e-a3f9-079a-02a0-8cee3e3c13b9@linaro.org> (raw)
In-Reply-To: <1584604540-10097-1-git-send-email-Anson.Huang@nxp.com>



On 19/03/2020 07:55, Anson Huang wrote:
> Several logic improvements to save many code lines:
> 
>   - no need to use goto;
>   - no need to assign return value;
>   - combine different conditions of return value into one line.
> 
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>

Applied thanks,
--srini
> ---
>   drivers/nvmem/imx-ocotp.c | 9 ++-------
>   1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c
> index 50bea2a..7a1ebd6 100644
> --- a/drivers/nvmem/imx-ocotp.c
> +++ b/drivers/nvmem/imx-ocotp.c
> @@ -196,7 +196,6 @@ static int imx_ocotp_read(void *context, unsigned int offset,
>   		if (*(buf - 1) == IMX_OCOTP_READ_LOCKED_VAL)
>   			imx_ocotp_clr_err_if_set(priv);
>   	}
> -	ret = 0;
>   
>   read_end:
>   	clk_disable_unprepare(priv->clk);
> @@ -435,17 +434,13 @@ static int imx_ocotp_write(void *context, unsigned int offset, void *val,
>   	       priv->base + IMX_OCOTP_ADDR_CTRL_SET);
>   	ret = imx_ocotp_wait_for_busy(priv,
>   				      priv->params->ctrl.bm_rel_shadows);
> -	if (ret < 0) {
> +	if (ret < 0)
>   		dev_err(priv->dev, "timeout during shadow register reload\n");
> -		goto write_end;
> -	}
>   
>   write_end:
>   	clk_disable_unprepare(priv->clk);
>   	mutex_unlock(&ocotp_mutex);
> -	if (ret < 0)
> -		return ret;
> -	return bytes;
> +	return ret < 0 ? ret : bytes;
>   }
>   
>   static struct nvmem_config imx_ocotp_nvmem_config = {
> 

      reply	other threads:[~2020-04-17 12:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-19  7:55 Anson Huang
2020-04-17 12:17 ` Srinivas Kandagatla [this message]

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=9794030e-a3f9-079a-02a0-8cee3e3c13b9@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=Anson.Huang@nxp.com \
    --cc=Linux-imx@nxp.com \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@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®