[PATCH master 7/7] bootm: booti: fix false positive uninitialized variable access

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

 



devicetree is only initialized when oftree is non-NULL and it's only
printed when oftree is non-NULL, so warning about devicetree use in the
printf looks like a false positive. Given that devicetree = *oftree, but
with a different type, we can avoid the warning and reduce devicetree
scope in the progress, by just using *oftree in the printf (%pad takes
a reference to phys_addr_t).

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 common/booti.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/common/booti.c b/common/booti.c
index 302d7440abd7..e745ff696376 100644
--- a/common/booti.c
+++ b/common/booti.c
@@ -33,7 +33,7 @@ void *booti_load_image(struct image_data *data, phys_addr_t *oftree)
 {
 	const void *kernel_header =
 			data->os_fit ? data->fit_kernel : data->os_header;
-	unsigned long text_offset, image_size, devicetree, kernel;
+	unsigned long text_offset, image_size, kernel;
 	unsigned long image_end;
 	int ret;
 	void *fdt;
@@ -57,6 +57,8 @@ void *booti_load_image(struct image_data *data, phys_addr_t *oftree)
 	image_end = PAGE_ALIGN(kernel + image_size);
 
 	if (oftree) {
+		unsigned long devicetree;
+
 		if (bootm_has_initrd(data)) {
 			ret = bootm_load_initrd(data, image_end);
 			if (ret)
@@ -84,7 +86,7 @@ void *booti_load_image(struct image_data *data, phys_addr_t *oftree)
 
 	printf("Loaded kernel to 0x%08lx", kernel);
 	if (oftree)
-		printf(", devicetree at 0x%08lx", devicetree);
+		printf(", devicetree at %pa", oftree);
 	printf("\n");
 
 	return (void *)kernel;
-- 
2.39.2





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

  Powered by Linux