lkml.org 
[lkml]   [2023]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 2/3] nvmem: sprd: Fix programming errors in efuse caused by incorrect parameters
From


On 12/8/2023 2:11 PM, Yanxin Huang wrote:
> The second argument to sprd_efuse_raw_prog() is the efuse index block
> data, but the data passed in is the efuse block offset, which can cause
> efuse to be programmed to the wrong block.
>
> Fixes: 096030e7f449 ("nvmem: sprd: Add Spreadtrum SoCs eFuse support")
> Signed-off-by: Yanxin Huang <yanxin.huang@unisoc.com>

Good catch.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>

> ---
> drivers/nvmem/sprd-efuse.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/nvmem/sprd-efuse.c b/drivers/nvmem/sprd-efuse.c
> index 24b63620d217..f0880f8fc56d 100644
> --- a/drivers/nvmem/sprd-efuse.c
> +++ b/drivers/nvmem/sprd-efuse.c
> @@ -326,6 +326,7 @@ static int sprd_efuse_write(void *context, u32 offset, void *val, size_t bytes)
> {
> struct sprd_efuse *efuse = context;
> bool blk_double = efuse->data->blk_double;
> + u32 index = offset / SPRD_EFUSE_BLOCK_WIDTH + efuse->data->blk_offset;
> bool lock;
> int ret;
>
> @@ -350,7 +351,7 @@ static int sprd_efuse_write(void *context, u32 offset, void *val, size_t bytes)
> else
> lock = true;
>
> - ret = sprd_efuse_raw_prog(efuse, offset, blk_double, lock, val);
> + ret = sprd_efuse_raw_prog(efuse, index, blk_double, lock, val);
>
> clk_disable_unprepare(efuse->clk);
>

\
 
 \ /
  Last update: 2023-12-12 04:29    [W:0.059 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site