[PATCH] nvmem: imx-ocotp-ele: correct ELE fuse check

From: Peng Fan (OSS)
Date: Thu Aug 08 2024 - 09:45:16 EST


From: Peng Fan <peng.fan@xxxxxxx>

"type | FUSE_ECC" will be always true. To check whether the fuse is ECC
fuse, need use "type & FUSE_ECC"

Reported-by: kernel test robot <lkp@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-kbuild-all/202408080514.wuSJ2V3A-lkp@xxxxxxxxx/
Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
---

V1:
Fixes tag not added, because it is still in next tree.
My yocto toolchain not report build warning. But this is a silly bug that
I just see there is value out and suppose it is correct. The value was indeed
correct, but only the lower half.

drivers/nvmem/imx-ocotp-ele.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvmem/imx-ocotp-ele.c b/drivers/nvmem/imx-ocotp-ele.c
index 4f22310920a2..1ba494497698 100644
--- a/drivers/nvmem/imx-ocotp-ele.c
+++ b/drivers/nvmem/imx-ocotp-ele.c
@@ -94,7 +94,7 @@ static int imx_ocotp_reg_read(void *context, unsigned int offset, void *val, siz
continue;
}

- if (type | FUSE_ECC)
+ if (type & FUSE_ECC)
*buf++ = readl_relaxed(reg + (i << 2)) & GENMASK(15, 0);
else
*buf++ = readl_relaxed(reg + (i << 2));
--
2.37.1