diff options
author | Shimoda, Yoshihiro <yoshihiro.shimoda.uh@renesas.com> | 2012-06-11 20:34:33 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-14 20:13:34 -0400 |
commit | 5897b038296ea84e501ba5f957e11939f8cf9be0 (patch) | |
tree | 04b5b606356e6294f2471017498b80f33bce3627 /drivers/usb | |
parent | 6c4707f3f8c44ec18282e1c014c80e1c257042f9 (diff) |
usb: ehci-sh: fix illegal phy_init() running when platform_data is NULL
If the platform_data is not set, pdata will be uninitialized value.
Since the driver has the following code, if the condition is true when
the pdata is uninitialized value, the driver may jump to the illegal
phy_init().
if (pdata && pdata->phy_init)
pdata->phy_init();
This patch also fixes the following warning:
CC drivers/usb/host/ehci-hcd.o
drivers/usb/host/ehci-sh.c: In function ‘ehci_hcd_sh_probe’:
drivers/usb/host/ehci-sh.c:104: warning: ‘pdata’ may be used uninitialized in this function
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/host/ehci-sh.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/usb/host/ehci-sh.c b/drivers/usb/host/ehci-sh.c index ca819cdd0c5e..e7cb3925abf8 100644 --- a/drivers/usb/host/ehci-sh.c +++ b/drivers/usb/host/ehci-sh.c | |||
@@ -126,8 +126,7 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev) | |||
126 | goto fail_create_hcd; | 126 | goto fail_create_hcd; |
127 | } | 127 | } |
128 | 128 | ||
129 | if (pdev->dev.platform_data != NULL) | 129 | pdata = pdev->dev.platform_data; |
130 | pdata = pdev->dev.platform_data; | ||
131 | 130 | ||
132 | /* initialize hcd */ | 131 | /* initialize hcd */ |
133 | hcd = usb_create_hcd(&ehci_sh_hc_driver, &pdev->dev, | 132 | hcd = usb_create_hcd(&ehci_sh_hc_driver, &pdev->dev, |