Skip to contentSkip to conversation

Fix Trivial Warnining in drivers/ata/libata-scsi.c

PATCH In review Subrata Modak 2 participants 3 messages Apr 27, 2009 libata

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix Trivial Warnining in drivers/ata/libata-scsi.c

Hi Jeff,

I observed the following warning for drivers/ata/libata-scsi.c:

drivers/ata/libata-scsi.c: In function ‘ata_scsi_scan_host’:
drivers/ata/libata-scsi.c:3272: warning: ‘dev’ may be used uninitialized in this function
---

In most instances=>
struct ata_device *dev
has been initialized except the above instance. My trivial patch below fixes this. Please include it if you like it.

To: Jeff Garzik <[email protected]>

---

drivers/ata/libata-scsi.c +1 -1
@@ -3269,7 +3269,7 @@ void ata_scsi_scan_host(struct ata_port 
 	int tries = 5;
 	struct ata_device *last_failed_dev = NULL;
 	struct ata_link *link;
-	struct ata_device *dev;
+	struct ata_device *dev = NULL;
 
 	if (ap->flags & ATA_FLAG_DISABLED)
 		return;

---
Regards--
Subrata

#1 lore raw
Quoted 23 lines · Subrata Modak

Hi Jeff,

I observed the following warning for drivers/ata/libata-scsi.c:

drivers/ata/libata-scsi.c: In function ‘ata_scsi_scan_host’:
drivers/ata/libata-scsi.c:3272: warning: ‘dev’ may be used uninitialized in this function
---

In most instances=>
struct ata_device *dev
has been initialized except the above instance. My trivial patch below fixes this. Please include it if you like it.

To: Jeff Garzik <[email protected]>

---

drivers/ata/libata-scsi.c void ata_scsi_scan_host(struct ata_port · line 3274

Quoted 7 lines
drivers/ata/libata-scsi.c +1 -1
@@ -3269,7 +3269,7 @@ void ata_scsi_scan_host(struct ata_port 
 	int tries = 5;
 	struct ata_device *last_failed_dev = NULL;
 	struct ata_link *link;
-	struct ata_device *dev;
+	struct ata_device *dev = NULL;
 
 	if (ap->flags & ATA_FLAG_DISABLED)

What was the conclusion of the analysis? :)

Is this a kernel bug, or gcc bug?

Jeff

#2 lore raw

Hi Jeff,

Quoted 30 lines · Jeff Garzik
Quoted 29 lines · Subrata Modak

Hi Jeff,

I observed the following warning for drivers/ata/libata-scsi.c:

drivers/ata/libata-scsi.c: In function ‘ata_scsi_scan_host’:
drivers/ata/libata-scsi.c:3272: warning: ‘dev’ may be used uninitialized in this function
---

In most instances=>
struct ata_device *dev
has been initialized except the above instance. My trivial patch below fixes this. Please include it if you like it.

To: Jeff Garzik <[email protected]>

---

drivers/ata/libata-scsi.c +1 -1
@@ -3269,7 +3269,7 @@ void ata_scsi_scan_host(struct ata_port 
 	int tries = 5;
 	struct ata_device *last_failed_dev = NULL;
 	struct ata_link *link;
-	struct ata_device *dev;
+	struct ata_device *dev = NULL;
 
Quoted 5 lines

drivers/ata/libata-scsi.c void ata_scsi_scan_host(struct ata_port · line 3274

Quoted 1 line
drivers/ata/libata-scsi.c +0 -0
 	if (ap->flags & ATA_FLAG_DISABLED)

What was the conclusion of the analysis? :)

Is this a kernel bug, or gcc bug?

Oops. I just wrote the patch to disable the build warning. As, i found that in other instances of use of the same declaration, it has been initialized, and the compiler was complaining for this instance alone. Hence, thought of addressing through a small fix.

Regards--
Subrata

Quoted 6 lines

Jeff