[PATCH 10/22] nvmem: fix clang-analyzer false-positive use of uninitialized value

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Mar 13 00:34:33 PDT 2025


clang-analyzer believes len can be returned uninitialized, but reading
the code this seems impossible. Anyways, let's initialize it by zero to
be able to focus on the more reports.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/nvmem/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 4e69b3fa582b..38dfb2cf2d1f 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -692,7 +692,7 @@ ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem,
 {
 	struct nvmem_cell cell;
 	int rc;
-	ssize_t len;
+	ssize_t len = 0;
 
 	if (!nvmem)
 		return -EINVAL;
-- 
2.39.5




More information about the barebox mailing list