[PATCH] nvmem: rockchip-otp: initialize ret in rk3588_otp_read
Jonas Karlman
jonas at kwiboo.se
Wed Jun 17 12:15:28 PDT 2026
Hi Ruoyu,
On 6/17/2026 8:38 PM, Ruoyu Wang wrote:
> 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
>
> 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) |
More information about the Linux-rockchip
mailing list