diff mbox series

nvmem: imx-ocotp-ele: correct ELE fuse check

Message ID 20240808135352.575378-1-peng.fan@oss.nxp.com (mailing list archive)
State New, archived
Headers show
Series nvmem: imx-ocotp-ele: correct ELE fuse check | expand

Commit Message

Peng Fan (OSS) Aug. 8, 2024, 1:53 p.m. UTC
From: Peng Fan <peng.fan@nxp.com>

"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@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408080514.wuSJ2V3A-lkp@intel.com/
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---

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 mbox series

Patch

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));