[PATCH] Fix reference of uninitialised memory in ata_device_add()
authorDave Jones <davej@redhat.com>
Wed, 27 Sep 2006 06:52:50 +0000 (23:52 -0700)
committerJeff Garzik <jeff@garzik.org>
Wed, 27 Sep 2006 22:05:40 +0000 (18:05 -0400)
ata_device_add fails, calls ata_host_remove with pointers to unitialized
memory.

Signed-off-by: Dave Jones <davej@redhat.com>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/ata/libata-core.c

index b4abd6850367d219e2cb1d59218bf7773b147879..396493cc98cec007f0bb95d45f47ac7247e26fdd 100644 (file)
@@ -5478,11 +5478,10 @@ int ata_device_add(const struct ata_probe_ent *ent)
                int irq_line = ent->irq;
 
                ap = ata_port_add(ent, host, i);
+               host->ports[i] = ap;
                if (!ap)
                        goto err_out;
 
-               host->ports[i] = ap;
-
                /* dummy? */
                if (ent->dummy_port_mask & (1 << i)) {
                        ata_port_printk(ap, KERN_INFO, "DUMMY\n");