[Cbe-oss-dev] [PATCH] ohci-ps3: fix panic on unloading ohci-hcd

Akinobu Mita mita at fixstars.com
Thu Mar 15 13:12:31 EST 2007


I have got panic when I did modprobe -r ohci-hcd on PS3.

ps3_ohci_sb_remove() does not clean several resources
allocated by ps3_ohci_sb_probe()

This patch fixes the problem, but I am not very sure that
holding virq in struct ps3_system_bus_device is good idea.

ehci-ps3 also has same problem.

Cc: Geoff Levand <geoffrey.levand at am.sony.com>
Signed-off-by: Akinobu Mita <mita at fixstars.com>

---
 drivers/usb/host/ohci-ps3.c |    8 +++++++-
 include/asm-powerpc/ps3.h   |    1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

Index: 2.6-git-ps3-03-14/drivers/usb/host/ohci-ps3.c
===================================================================
--- 2.6-git-ps3-03-14.orig/drivers/usb/host/ohci-ps3.c
+++ 2.6-git-ps3-03-14/drivers/usb/host/ohci-ps3.c
@@ -115,6 +115,7 @@ static int ps3_ohci_sb_probe(struct ps3_
 		result = -EPERM;
 		goto fail_irq;
 	}
+	dev->virq = virq;
 
 	dev->core.power.power_state = PMSG_ON;
 	dev->core.dma_mask = &dummy_mask; /* FIXME: for improper usb code */
@@ -161,6 +162,7 @@ static int ps3_ohci_sb_probe(struct ps3_
 	return result;
 
 fail_add_hcd:
+	ps3_system_bus_set_driver_data(dev, NULL);
 	iounmap(hcd->regs);
 fail_ioremap:
 	usb_put_hcd(hcd);
@@ -178,8 +180,12 @@ static int ps3_ohci_sb_remove (struct ps
 	struct usb_hcd *hcd =
 		(struct usb_hcd *)ps3_system_bus_get_driver_data(dev);
 
-	usb_put_hcd(hcd);
+	usb_remove_hcd(hcd);
 	ps3_system_bus_set_driver_data(dev, NULL);
+	iounmap(hcd->regs);
+	usb_put_hcd(hcd);
+	ps3_free_io_irq(dev->virq);
+	ps3_free_mmio_region(dev->m_region);
 
 	return 0;
 }
Index: 2.6-git-ps3-03-14/include/asm-powerpc/ps3.h
===================================================================
--- 2.6-git-ps3-03-14.orig/include/asm-powerpc/ps3.h
+++ 2.6-git-ps3-03-14/include/asm-powerpc/ps3.h
@@ -299,6 +299,7 @@ struct ps3_system_bus_device {
 	enum ps3_match_id match_id;
 	struct ps3_device_id did;
 	unsigned int interrupt_id;
+	unsigned int virq;
 /*	struct iommu_table *iommu_table; -- waiting for Ben's cleanups */
 	struct ps3_dma_region *d_region;
 	struct ps3_mmio_region *m_region;



More information about the cbe-oss-dev mailing list