aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Zapolskiy <vz@mleia.com>2016-04-25 16:53:31 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-04-26 17:50:02 -0400
commit97b9b7dc7722dc78d46046fc7a0dd0264832327f (patch)
treef4ce1389ae6fefe5a3c5e51b364a87955ab3e732
parentf551e13529833e052f75ec628a8af7b034af20f9 (diff)
usb: musb: jz4740: fix error check of usb_get_phy()
The usb_get_phy() function returns either a valid pointer to phy or ERR_PTR() error, check for NULL always fails and may lead to oops on error path, fix this issue. Signed-off-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/musb/jz4740.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c
index 5e5a8fa005f8..bc8889956d17 100644
--- a/drivers/usb/musb/jz4740.c
+++ b/drivers/usb/musb/jz4740.c
@@ -83,9 +83,9 @@ static int jz4740_musb_init(struct musb *musb)
83{ 83{
84 usb_phy_generic_register(); 84 usb_phy_generic_register();
85 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); 85 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
86 if (!musb->xceiv) { 86 if (IS_ERR(musb->xceiv)) {
87 pr_err("HS UDC: no transceiver configured\n"); 87 pr_err("HS UDC: no transceiver configured\n");
88 return -ENODEV; 88 return PTR_ERR(musb->xceiv);
89 } 89 }
90 90
91 /* Silicon does not implement ConfigData register. 91 /* Silicon does not implement ConfigData register.