[PATCH] nvmem: rockchip-otp: initialize ret in rk3588_otp_read
Ruoyu Wang
ruoyuw560 at gmail.com
Wed Jun 17 11:38:03 PDT 2026
rk3588_otp_read() returns ret after a count-controlled loop. If count is
zero, the loop is skipped and ret is not assigned. Initialize ret to 0
for the empty read path.
Signed-off-by: Ruoyu Wang <ruoyuw560 at gmail.com>
---
drivers/nvmem/rockchip-otp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvmem/rockchip-otp.c b/drivers/nvmem/rockchip-otp.c
index 0ec78b5e19e7d..50a19b6dc4027 100644
--- a/drivers/nvmem/rockchip-otp.c
+++ b/drivers/nvmem/rockchip-otp.c
@@ -242,7 +242,7 @@ static int rk3588_otp_read(void *context, unsigned int offset,
{
struct rockchip_otp *otp = context;
u32 *buf = val;
- int ret;
+ int ret = 0;
while (count--) {
writel((offset++ << RK3588_ADDR_SHIFT) |
--
2.51.0
More information about the Linux-rockchip
mailing list