From: Randy Dunlap Save and free the correct acpi_object pointer. Signed-off-by: Randy Dunlap Signed-off-by: Andrew Morton --- drivers/scsi/libata-acpi.c | 14 +++++++++----- drivers/scsi/libata.h | 6 ++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff -puN drivers/scsi/libata-acpi.c~sata-acpi-objects-support-save-free-the-correct-acpi-object drivers/scsi/libata-acpi.c --- 25/drivers/scsi/libata-acpi.c~sata-acpi-objects-support-save-free-the-correct-acpi-object Tue Jan 17 16:14:23 2006 +++ 25-akpm/drivers/scsi/libata-acpi.c Tue Jan 17 16:14:23 2006 @@ -299,7 +299,8 @@ EXPORT_SYMBOL_GPL(ata_acpi_push_id); * function return value is 0. */ int do_drive_get_GTF(struct ata_port *ap, struct ata_device *atadev, - unsigned int *gtf_length, unsigned long *gtf_address) + unsigned int *gtf_length, unsigned long *gtf_address, + unsigned long *obj_loc) { acpi_status status; acpi_handle handle; @@ -318,6 +319,7 @@ int do_drive_get_GTF(struct ata_port *ap *gtf_length = 0; *gtf_address = 0UL; + *obj_loc = 0UL; if (!ata_dev_present(atadev) || (ap->flags & ATA_FLAG_PORT_DISABLED)) { @@ -408,10 +410,11 @@ int do_drive_get_GTF(struct ata_port *ap *gtf_length = out_obj->buffer.length; *gtf_address = (unsigned long)out_obj->buffer.pointer; + *obj_loc = (unsigned long)out_obj; if (ata_msg_probe(ap)) printk(KERN_DEBUG "%s: returning " - "gtf_length=%d, gtf_address=0x%lx\n", - __FUNCTION__, *gtf_length, *gtf_address); + "gtf_length=%d, gtf_address=0x%lx, obj_loc=0x%lx\n", + __FUNCTION__, *gtf_length, *gtf_address, *obj_loc); err = 0; out: return err; @@ -549,6 +552,7 @@ int ata_acpi_exec_tfs(struct ata_port *a int ret; unsigned int gtf_length; unsigned long gtf_address; + unsigned long obj_loc; if (ata_msg_probe(ap)) printk(KERN_DEBUG "%s: ENTER:\n", __FUNCTION__); @@ -558,7 +562,7 @@ int ata_acpi_exec_tfs(struct ata_port *a printk(KERN_DEBUG "%s: call get_GTF, ix=%d\n", __FUNCTION__, ix); ret = do_drive_get_GTF(ap, &ap->device[ix], - >f_length, >f_address); + >f_length, >f_address, &obj_loc); if (ret < 0) { if (ata_msg_probe(ap)) printk(KERN_DEBUG "%s: get_GTF error (%d)\n", @@ -571,7 +575,7 @@ int ata_acpi_exec_tfs(struct ata_port *a __FUNCTION__, ix); ret = do_drive_set_taskfiles(ap, &ap->device[ix], gtf_length, gtf_address); - acpi_os_free((void *)gtf_address); + acpi_os_free((void *)obj_loc); if (ret < 0) { if (ata_msg_probe(ap)) printk(KERN_DEBUG diff -puN drivers/scsi/libata.h~sata-acpi-objects-support-save-free-the-correct-acpi-object drivers/scsi/libata.h --- 25/drivers/scsi/libata.h~sata-acpi-objects-support-save-free-the-correct-acpi-object Tue Jan 17 16:14:23 2006 +++ 25-akpm/drivers/scsi/libata.h Tue Jan 17 16:14:23 2006 @@ -62,7 +62,8 @@ extern unsigned int ata_exec_internal(st #ifdef CONFIG_SCSI_SATA_ACPI extern int ata_acpi_push_id(struct ata_port *ap, unsigned int ix); extern int do_drive_get_GTF(struct ata_port *ap, struct ata_device *atadev, - unsigned int *gtf_length, unsigned long *gtf_address); + unsigned int *gtf_length, unsigned long *gtf_address, + unsigned long *obj_loc); extern int do_drive_set_taskfiles(struct ata_port *ap, struct ata_device *atadev, unsigned int gtf_length, unsigned long gtf_address); extern int ata_acpi_exec_tfs(struct ata_port *ap); @@ -73,7 +74,8 @@ static inline int ata_acpi_push_id(struc } static inline int do_drive_get_GTF(struct ata_port *ap, struct ata_device *atadev, - unsigned int *gtf_length, unsigned long *gtf_address) + unsigned int *gtf_length, unsigned long *gtf_address, + unsigned long *obj_loc) { return 0; } _