diff options
author | Anson Huang <Anson.Huang@nxp.com> | 2020-05-11 15:50:40 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-05-15 16:20:02 +0200 |
commit | 0e2abffdf928c57af9dfb334e9aa54e430e3b424 (patch) | |
tree | 3bdc873ab4937c395e5496a6d3c4263fc7efc9d9 /drivers/nvmem/imx-ocotp.c | |
parent | 65f0539b1d063a186723c5c9a7eb17d1962c84a0 (diff) | |
download | linux-0e2abffdf928c57af9dfb334e9aa54e430e3b424.tar.gz linux-0e2abffdf928c57af9dfb334e9aa54e430e3b424.tar.bz2 linux-0e2abffdf928c57af9dfb334e9aa54e430e3b424.zip |
nvmem: imx-ocotp: Improve logic to save many code lines
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>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20200511145042.31223-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/nvmem/imx-ocotp.c')
-rw-r--r-- | drivers/nvmem/imx-ocotp.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c index 50bea2aadc1b..7a1ebd6fd08b 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 = { |