[PATCH] ATA: fix a problem that ata port print_id is used uninitialized

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

 



fix a problem that ata port print_id is used uninitialized.

port print_id is initialized in ata_host_register, but it's
used in ata_host_start.
Now move it to ata_host_start, before it's invoked for the first time.

Signed-off-by: Zhang Rui <rui.zhang@xxxxxxxxx>
---
 drivers/ata/libata-core.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Index: linux-2.6/drivers/ata/libata-core.c
===================================================================
--- linux-2.6.orig/drivers/ata/libata-core.c
+++ linux-2.6/drivers/ata/libata-core.c
@@ -5963,6 +5963,8 @@ int ata_host_start(struct ata_host *host
 	for (i = 0; i < host->n_ports; i++) {
 		struct ata_port *ap = host->ports[i];
 
+		host->ports[i]->print_id = ata_print_id++;
+
 		if (ap->ops->port_start) {
 			rc = ap->ops->port_start(ap);
 			if (rc) {
@@ -6107,10 +6109,6 @@ int ata_host_register(struct ata_host *h
 	for (i = host->n_ports; host->ports[i]; i++)
 		kfree(host->ports[i]);
 
-	/* give ports names and add SCSI hosts */
-	for (i = 0; i < host->n_ports; i++)
-		host->ports[i]->print_id = ata_print_id++;
-
 	rc = ata_scsi_add_hosts(host, sht);
 	if (rc)
 		return rc;


--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux