Re: via sata oops on init

From: Johannes Weiner
Date: Sat Jul 29 2006 - 13:03:07 EST


Hi,

On Sat, Jul 29, 2006 at 12:41:15PM -0400, Dave Jones wrote:
> --- linux-2.6/drivers/scsi/libata-core.c~ 2006-07-29 12:35:32.000000000 -0400
> +++ linux-2.6/drivers/scsi/libata-core.c 2006-07-29 12:39:08.000000000 -0400
> @@ -5419,10 +5419,10 @@ int ata_device_add(const struct ata_prob
> unsigned long xfer_mode_mask;
>
> ap = ata_host_add(ent, host_set, i);
> + host_set->ports[i] = ap;
> if (!ap)
> goto err_out;
>
> - host_set->ports[i] = ap;
> xfer_mode_mask =(ap->udma_mask << ATA_SHIFT_UDMA) |
> (ap->mwdma_mask << ATA_SHIFT_MWDMA) |
> (ap->pio_mask << ATA_SHIFT_PIO);
> @@ -5532,6 +5532,8 @@ int ata_device_add(const struct ata_prob
>
> err_out:
> for (i = 0; i < count; i++) {
> + if (!host_set->ports[i])
> + break;
> ata_host_remove(host_set->ports[i], 1);
> scsi_host_put(host_set->ports[i]->host);
> }

You jump into loop just to skip it.

Signed-off-by: Johannes Weiner <hanzfoo@xxxxxxxxx>

diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 386e5f2..064ee85 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -5420,7 +5420,7 @@ int ata_device_add(const struct ata_prob

ap = ata_host_add(ent, host_set, i);
if (!ap)
- goto err_out;
+ goto err_free_ret;

host_set->ports[i] = ap;
xfer_mode_mask =(ap->udma_mask << ATA_SHIFT_UDMA) |