The patch below does not apply to the 4.19-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to stable@vger.kernel.org.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-4.19.y git checkout FETCH_HEAD git cherry-pick -x 7a0a6d0a7c805f9380381f4deedffdf87b93f408 # <resolve conflicts, build, test, etc.> git commit -s git send-email --to 'stable@vger.kernel.org' --in-reply-to '2024071511-unwritten-backache-b96e@gregkh' --subject-prefix 'PATCH 4.19.y' HEAD^..
Possible dependencies:
7a0a6d0a7c80 ("nvmem: meson-efuse: Fix return value of nvmem callbacks") 8cde3c2153e8 ("firmware: meson_sm: Rework driver as a proper platform driver") 611fbca1c861 ("nvmem: meson-efuse: add peripheral clock") 8649dbe58d35 ("nvmem: meson-efuse: add error message on user_max failure.") 0789724f86a5 ("firmware: meson_sm: Add serial number sysfs entry")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 7a0a6d0a7c805f9380381f4deedffdf87b93f408 Mon Sep 17 00:00:00 2001 From: Joy Chakraborty joychakr@google.com Date: Fri, 28 Jun 2024 12:37:02 +0100 Subject: [PATCH] nvmem: meson-efuse: Fix return value of nvmem callbacks
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 Reviewed-by: Dan Carpenter dan.carpenter@linaro.org Reviewed-by: Neil Armstrong neil.armstrong@linaro.org Signed-off-by: Srinivas Kandagatla srinivas.kandagatla@linaro.org Link: https://lore.kernel.org/r/20240628113704.13742-3-srinivas.kandagatla@linaro.... Signed-off-by: Greg Kroah-Hartman gregkh@linuxfoundation.org
diff --git a/drivers/nvmem/meson-efuse.c b/drivers/nvmem/meson-efuse.c index 33678d0af2c2..6c2f80e166e2 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;
- return meson_sm_call_write(fw, (u8 *)val, bytes, SM_EFUSE_WRITE, offset, - bytes, 0, 0, 0); + ret = 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[] = {
linux-stable-mirror@lists.linaro.org