nvmem: rockchip-otp: initialize ret in rk3588_otp_read
Subsystems (2)
PATCH 1/1 nvmem: rockchip-otp: initialize ret in rk3588_otp_read
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 <[email protected]>
--- drivers/nvmem/rockchip-otp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvmem/rockchip-otp.c +1 -1
@@ -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) |
Signature · 1 line
2.51.0
Hi Ruoyu,
Quoted 3 lines · Ruoyu Wang
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.
To my knowledge core will protect against bytes<=0 read, if that is not the case we should likely fix so that rockchip_otp_read() never calls the internal reg_read ops with bytes/count<=0.
Regards,
Jonas
Quoted 19 lines
Signed-off-by Ruoyu Wang <[email protected]>--- drivers/nvmem/rockchip-otp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/nvmem/rockchip-otp.c +1
-1@@ -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) |