Tejun Heo wrote:
Don't embed ap inside shost. Allocate it separately and point it back
from shosts's hostdata. This makes port allocation more flexible and
allows regular ATA and SAS share host alloc/init paths.
Signed-off-by: Tejun Heo <htejun@xxxxxxxxx>
---
drivers/ata/libata-core.c | 15 +++++++++++----
include/linux/libata.h | 2 +-
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 6e124bd..fab488c 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5646,14 +5646,17 @@ static struct ata_port * ata_port_add(const struct ata_probe_ent *ent,
return NULL;
}
- shost = scsi_host_alloc(ent->sht, sizeof(struct ata_port));
+ ap = kzalloc(sizeof(struct ata_port), GFP_KERNEL);
+ if (!ap)
+ return NULL;
+
+ shost = scsi_host_alloc(ent->sht, sizeof(struct ata_port *));
if (!shost)
return NULL;
memory leak on error
otherwise OK
-
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