Skip to contentSkip to conversation

Silencing warning: 'host' may be used uninitialized in this function

PATCH In review Marin Mitov 2 participants 4 messages Apr 9, 2009 – Apr 13, 2009 libata

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Silencing warning: 'host' may be used uninitialized in this function

Hi all,

I do not know if that is worth the effort, but...

Silencing: warning: 'host' may be used uninitialized in this function It is a false positive.

The patch is against 2.6.30-rc1, but should apply to 2.6.29(.1) too.

================================================

drivers/ata/sata_via.c +1 -1
@@ -566,7 +566,7 @@
 	static int printed_version;
 	unsigned int i;
 	int rc;
-	struct ata_host *host;
+	struct ata_host *host = host;
 	int board_id = (int) ent->driver_data;
 	const unsigned *bar_sizes;
 
#1 lore raw
Quoted 14 lines · Marin Mitov

Hi all,

I do not know if that is worth the effort, but...

Silencing: warning: 'host' may be used uninitialized in this function It is a false positive.

The patch is against 2.6.30-rc1, but should apply to 2.6.29(.1) too.

================================================

drivers/ata/sata_via.c line 571

Quoted 7 lines
drivers/ata/sata_via.c +1 -1
@@ -566,7 +566,7 @@
 	static int printed_version;
 	unsigned int i;
 	int rc;
-	struct ata_host *host;
+	struct ata_host *host = host;
 	int board_id = (int) ent->driver_data;
 	const unsigned *bar_sizes;

we use the uninitialized_var() macro for false positives.

Jeff

#2 lore raw
Quoted 25 lines · Jeff Garzik
Quoted 14 lines · Marin Mitov

Hi all,

I do not know if that is worth the effort, but...

Silencing: warning: 'host' may be used uninitialized in this function It is a false positive.

The patch is against 2.6.30-rc1, but should apply to 2.6.29(.1) too.

================================================

drivers/ata/sata_via.c line 571

Quoted 7 lines
drivers/ata/sata_via.c +1 -1
@@ -566,7 +566,7 @@
 	static int printed_version;
 	unsigned int i;
 	int rc;
-	struct ata_host *host;
+	struct ata_host *host = host;
 	int board_id = (int) ent->driver_data;
 	const unsigned *bar_sizes;

we use the uninitialized_var() macro for false positives.

Quoted 2 lines

Jeff

Well, changed and resubmitted.

Marin Mitov

Silencing: " warning: 'host' may be used uninitialized in this function"

The patch is against 2.6.30-rc1, but should apply to 2.6.29(.1) too.

================================================

drivers/ata/sata_via.c +1 -1
@@ -566,7 +566,7 @@
 	static int printed_version;
 	unsigned int i;
 	int rc;
-	struct ata_host *host;
+	struct ata_host *uninitialized_var(host);
 	int board_id = (int) ent->driver_data;
 	const unsigned *bar_sizes;
 
#3 lore raw
Quoted 41 lines · Marin Mitov
Quoted 24 lines · Jeff Garzik
Quoted 14 lines · Marin Mitov

Hi all,

I do not know if that is worth the effort, but...

Silencing: warning: 'host' may be used uninitialized in this function It is a false positive.

The patch is against 2.6.30-rc1, but should apply to 2.6.29(.1) too.

================================================

drivers/ata/sata_via.c line 571

Quoted 7 lines
drivers/ata/sata_via.c +1 -1
@@ -566,7 +566,7 @@
 	static int printed_version;
 	unsigned int i;
 	int rc;
-	struct ata_host *host;
+	struct ata_host *host = host;
 	int board_id = (int) ent->driver_data;
 	const unsigned *bar_sizes;

we use the uninitialized_var() macro for false positives.

Quoted 2 lines

Jeff

Well, changed and resubmitted.

Marin Mitov

Silencing: " warning: 'host' may be used uninitialized in this function"

The patch is against 2.6.30-rc1, but should apply to 2.6.29(.1) too.

================================================

drivers/ata/sata_via.c line 571

Quoted 7 lines
drivers/ata/sata_via.c +1 -1
@@ -566,7 +566,7 @@
 	static int printed_version;
 	unsigned int i;
 	int rc;
-	struct ata_host *host;
+	struct ata_host *uninitialized_var(host);
 	int board_id = (int) ent->driver_data;
 	const unsigned *bar_sizes;

I did this a slightly different way... I went ahead and simply initialized it.

Jeff