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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux