[PATCH master 2/3] partition: fix use of uninitialized variable in error message

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Jul 17 00:29:12 PDT 2024


The error message reports the partition number using the variable i, but
that's never initialized, as clang notices. Fix this.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 common/partitions.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/common/partitions.c b/common/partitions.c
index 0b10377e7327..d46ed4080597 100644
--- a/common/partitions.c
+++ b/common/partitions.c
@@ -241,7 +241,7 @@ void partition_desc_init(struct partition_desc *pd, struct block_device *blk)
  */
 int parse_partition_table(struct block_device *blk)
 {
-	int i;
+	int i = 0;
 	int rc = 0;
 	struct partition *part;
 	struct partition_desc *pdesc;
@@ -259,6 +259,8 @@ int parse_partition_table(struct block_device *blk)
 				i, blk->cdev.name, rc);
 		if (rc != -ENODEV)
 			rc = 0;
+
+		i++;
 	}
 
 	partition_table_free(pdesc);
-- 
2.39.2




More information about the barebox mailing list