[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] [PATCH] Fix failing call to Get_resource() PCI_BIOS function in EHCI driver



Commit message:

Save PCI device handle in ehci_pci structure before calling
ucd_register(), that function ends up calling Get_resource( ) PCI_BIOS
function that needs the device handle number.
Index: sys/usb/src.km/ucd/ehci/ehci-pci.c
===================================================================
RCS file: /mint/freemint/sys/usb/src.km/ucd/ehci/ehci-pci.c,v
retrieving revision 1.4
diff -u -8 -r1.4 ehci-pci.c
--- sys/usb/src.km/ucd/ehci/ehci-pci.c	20 Oct 2014 15:00:47 -0000	1.4
+++ sys/usb/src.km/ucd/ehci/ehci-pci.c	21 Oct 2014 10:31:52 -0000
@@ -232,27 +232,29 @@
 							while(board->vendor)
 							{
 								if((board->vendor == (id & 0xFFFF))
 								    && (board->device == (id >> 16)))
 								{
 									err = ehci_alloc_ucdif(&ehci_uif);
 									if (err < 0)
 										break;
+
+									struct ehci *gehci = (struct ehci *)ehci_uif->ucd_priv;
+									gehci->bus = kmalloc (sizeof(struct ehci_pci));
+									((struct ehci_pci *)gehci->bus)->handle = handle;
+									((struct ehci_pci *)gehci->bus)->ent = board;
+
 									/* assign an interface */
 									err = ucd_register(ehci_uif, &root_hub_dev);
 									if (err) 
 									{
 										DEBUG (("%s: ucd register failed!", __FILE__));
 										break;
 									}
-									struct ehci *gehci = (struct ehci *)ehci_uif->ucd_priv;
-									gehci->bus = kmalloc (sizeof(struct ehci_pci));
-									((struct ehci_pci *)gehci->bus)->handle = handle;
-									((struct ehci_pci *)gehci->bus)->ent = board;
 									DEBUG (("%s: ucd register ok", __FILE__));
 									break;
 								}
 								board++;
 							}
 						}
 					}
 				}