summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Chen <peter.chen@freescale.com>2013-03-22 13:16:22 +0800
committerPeter Chen <peter.chen@freescale.com>2013-05-06 08:12:19 +0800
commita070aad1adedd9bcece3254af11e96890ff41af8 (patch)
treedf3bfeb0ed070f23a7bccc66e71a59748a596006
parenta4cbe9106927be1c8c53315a7a23c9cb19cf82ef (diff)
ENGR00255484-2 usb: ehci-arc: add NULL pointer check for pdata->pdev
The pdata->pdev is initialized at platform code, if init fails at first, it will be not initialized, and platform exit will not be called. This also fixes an oop when config usb module wrongly: Unable to handle kernel NULL pointer dereference at virtual address 0000005c pgd = ba1c4000 [0000005c] *pgd=4a145831, *pte=00000000, *ppte=00000000 Internal error: Oops: 17 [#1] PREEMPT SMP Modules linked in: ehci_hcd(+) usbcore CPU: 1 Not tainted (3.0.35-02451-ge361da1 #60) PC is at fsl_usb_host_uninit_ext+0xc/0x28 LR is at usb_hcd_fsl_probe+0x2c8/0x44c [ehci_hcd] pc : [<80062b58>] lr : [<7f060934>] psr: a0000013 sp : ba11be80 ip : 00005027 fp : 000a76e0 r10: 00000048 r9 : ba11a000 r8 : bfd4d608 r7 : ffffffed r6 : bfd4d600 r5 : bfc84400 r4 : 80aaee48 r3 : 80062b4c r2 : 00000000 r1 : 60000093 r0 : 00000000 Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user Control: 10c53c7d Table: 4a1c404a DAC: 00000015 Process modprobe (pid: 1555, stack limit = 0xba11a2f0) Stack: (0xba11be80 to 0xba11c000) be80: bfd97600 7f060934 00000000 00000000 bfd4d608 bfd4d608 80aca808 bfd4d63c bea0: 7f062bd4 80041704 ba11a000 00000000 000a76e0 802a5cec bfd4d608 802a4a14 bec0: bfd4d608 7f062bd4 bfd4d63c 00000000 80041704 802a4bac 7f062bd4 ba11bee8 bee0: 802a4b20 802a4254 bffd4040 bff03f38 7f065000 7f062bd4 80a934c8 bfc8cd20 bf00: 00000000 802a3be0 7f062b1c 7f062bd4 00000000 7f017ec8 7f062bd4 00000000 bf20: 7f065000 80041704 00000000 802a51a0 7f017ec8 80aae500 00000000 7f065000 bf40: 80041704 7f065058 000a79e8 8003b4c4 00000000 00000000 00000000 80a14834 bf60: 000a79e8 000a79e8 7f062c20 00000000 0000e67b 80041704 ba11a000 00000000 bf80: 000a76e0 800aa428 ba076740 800f58dc 000a79e8 0000e67b 00000000 000a75d0 bfa0: 00000080 80041580 0000e67b 00000000 000a79e8 0000e67b 000a75d0 000a76e0 bfc0: 0000e67b 00000000 000a75d0 00000080 000a6a78 00000008 000a76a0 000a76e0 bfe0: 7ec7ab50 7ec7ab40 0001a32c 2ace6490 20000010 000a79e8 4fffe821 4fffec21 [<80062b58>] (fsl_usb_host_uninit_ext+0xc/0x28) from [<7f060934>] (usb_hcd_fsl_probe+0x2c8/0x44c [ehci_hcd]) [<7f060934>] (usb_hcd_fsl_probe+0x2c8/0x44c [ehci_hcd]) from [<802a5cec>] (platform_drv_probe+0x18/0x1c) [<802a5cec>] (platform_drv_probe+0x18/0x1c) from [<802a4a14>] (driver_probe_device+0x98/0x1a4) [<802a4a14>] (driver_probe_device+0x98/0x1a4) from [<802a4bac>] (__driver_attach+0x8c/0x90) [<802a4bac>] (__driver_attach+0x8c/0x90) from [<802a4254>] (bus_for_each_dev+0x60/0x8c) [<802a4254>] (bus_for_each_dev+0x60/0x8c) from [<802a3be0>] (bus_add_driver+0x184/0x25c) [<802a3be0>] (bus_add_driver+0x184/0x25c) from [<802a51a0>] (driver_register+0x78/0x13c) [<802a51a0>] (driver_register+0x78/0x13c) from [<7f065058>] (ehci_hcd_init+0x58/0x88 [ehci_hcd]) [<7f065058>] (ehci_hcd_init+0x58/0x88 [ehci_hcd]) from [<8003b4c4>] (do_one_initcall+0x30/0x16c) [<8003b4c4>] (do_one_initcall+0x30/0x16c) from [<800aa428>] (sys_init_module+0x84/0x19c) [<800aa428>] (sys_init_module+0x84/0x19c) from [<80041580>] (ret_fast_syscall+0x0/0x30) Code: 80aaee48 e92d4010 e30e4e48 e34840aa (e590005c) ---[ end trace 719afdfe4af3a442 ]--- Signed-off-by: Peter Chen <peter.chen@freescale.com>
-rwxr-xr-xdrivers/usb/host/ehci-arc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/host/ehci-arc.c b/drivers/usb/host/ehci-arc.c
index 080ba06b89b4..59a2f4bd2a20 100755
--- a/drivers/usb/host/ehci-arc.c
+++ b/drivers/usb/host/ehci-arc.c
@@ -316,7 +316,7 @@ err2:
err1:
dev_err(&pdev->dev, "init %s fail, %d\n", dev_name(&pdev->dev), retval);
fsl_usb_lowpower_mode(pdata, true);
- if (pdata->exit)
+ if (pdata->exit && pdata->pdev)
pdata->exit(pdata->pdev);
return retval;
}
@@ -379,7 +379,7 @@ static void usb_hcd_fsl_remove(struct usb_hcd *hcd,
/*
* do platform specific un-initialization
*/
- if (pdata->exit)
+ if (pdata->exit && pdata->pdev)
pdata->exit(pdata->pdev);
}