From: neil.armstrong@linaro.org
To: Joy Chakraborty <joychakr@google.com>,
Jerome Brunet <jbrunet@baylibre.com>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Dan Carpenter <dan.carpenter@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org,
linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] nvmem: meson-efuse: Fix return value of nvmem callbacks
Date: Tue, 11 Jun 2024 17:23:19 +0200 [thread overview]
Message-ID: <eefc2c96-7309-4ea0-855f-44eff9fb0077@linaro.org> (raw)
In-Reply-To: <20240611145524.1022656-1-joychakr@google.com>
On 11/06/2024 16:55, Joy Chakraborty wrote:
> Read/write callbacks registered with nvmem core expect 0 to be returned
> on success and a negative value to be returned on failure.
>
> meson_efuse_read() and meson_efuse_write() call into
> meson_sm_call_read() and meson_sm_call_write() respectively which return
> the number of bytes read or written on success as per their api
> description.
>
> Fix to return error if meson_sm_call_read()/meson_sm_call_write()
> returns an error else return 0.
>
> Fixes: a29a63bdaf6f ("nvmem: meson-efuse: simplify read callback")
> Cc: stable@vger.kernel.org
> Signed-off-by: Joy Chakraborty <joychakr@google.com>
> ---
> drivers/nvmem/meson-efuse.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/nvmem/meson-efuse.c b/drivers/nvmem/meson-efuse.c
> index 52ed9a62ca5b..d7f9ac99a212 100644
> --- a/drivers/nvmem/meson-efuse.c
> +++ b/drivers/nvmem/meson-efuse.c
> @@ -18,18 +18,24 @@ static int meson_efuse_read(void *context, unsigned int offset,
> void *val, size_t bytes)
> {
> struct meson_sm_firmware *fw = context;
> + int ret;
>
> - return meson_sm_call_read(fw, (u8 *)val, bytes, SM_EFUSE_READ, offset,
> - bytes, 0, 0, 0);
> + ret = meson_sm_call_read(fw, (u8 *)val, bytes, SM_EFUSE_READ, offset,
> + bytes, 0, 0, 0);
> +
> + return ret < 0 ? ret : 0;
> }
>
> static int meson_efuse_write(void *context, unsigned int offset,
> void *val, size_t bytes)
> {
> struct meson_sm_firmware *fw = context;
> + int ret;
> +
> + ret = meson_sm_call_write(fw, (u8 *)val, bytes, SM_EFUSE_WRITE, offset,
> + bytes, 0, 0, 0);
>
> - return meson_sm_call_write(fw, (u8 *)val, bytes, SM_EFUSE_WRITE, offset,
> - bytes, 0, 0, 0);
> + return ret < 0 ? ret : 0;
> }
>
> static const struct of_device_id meson_efuse_match[] = {
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-06-11 15:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-11 14:55 [PATCH] nvmem: meson-efuse: Fix return value of nvmem callbacks Joy Chakraborty
2024-06-11 15:23 ` neil.armstrong [this message]
2024-06-11 15:28 ` Dan Carpenter
2024-06-21 6:20 ` Srinivas Kandagatla
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=eefc2c96-7309-4ea0-855f-44eff9fb0077@linaro.org \
--to=neil.armstrong@linaro.org \
--cc=dan.carpenter@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=jbrunet@baylibre.com \
--cc=joychakr@google.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=srinivas.kandagatla@linaro.org \
--cc=stable@vger.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