diff options
author | Kishon Vijay Abraham I <kishon@ti.com> | 2012-06-26 08:10:32 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-07-02 03:40:49 -0400 |
commit | ded017ee6c7b90f7356bd8488f8af1c10ba90490 (patch) | |
tree | 1ed1612aa13f24e1aa8480fb497d2a0311fae9cc /drivers/usb/musb | |
parent | b8a3efa3a363720687d21228d6b23b988a223bbb (diff) |
usb: phy: fix return value check of usb_get_phy
usb_get_phy will return -ENODEV if it's not able to find the phy. Hence
fixed all the callers of usb_get_phy to check for this error condition
instead of relying on a non-zero value as success condition.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r-- | drivers/usb/musb/am35x.c | 3 | ||||
-rw-r--r-- | drivers/usb/musb/blackfin.c | 3 | ||||
-rw-r--r-- | drivers/usb/musb/da8xx.c | 3 | ||||
-rw-r--r-- | drivers/usb/musb/davinci.c | 3 | ||||
-rw-r--r-- | drivers/usb/musb/musb_dsps.c | 3 | ||||
-rw-r--r-- | drivers/usb/musb/omap2430.c | 2 | ||||
-rw-r--r-- | drivers/usb/musb/tusb6010.c | 3 | ||||
-rw-r--r-- | drivers/usb/musb/ux500.c | 3 |
8 files changed, 15 insertions, 8 deletions
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c index 4a8cbf0e8d51..7a95ab87ac00 100644 --- a/drivers/usb/musb/am35x.c +++ b/drivers/usb/musb/am35x.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/clk.h> | 31 | #include <linux/clk.h> |
32 | #include <linux/err.h> | ||
32 | #include <linux/io.h> | 33 | #include <linux/io.h> |
33 | #include <linux/platform_device.h> | 34 | #include <linux/platform_device.h> |
34 | #include <linux/dma-mapping.h> | 35 | #include <linux/dma-mapping.h> |
@@ -365,7 +366,7 @@ static int am35x_musb_init(struct musb *musb) | |||
365 | 366 | ||
366 | usb_nop_xceiv_register(); | 367 | usb_nop_xceiv_register(); |
367 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); | 368 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); |
368 | if (!musb->xceiv) | 369 | if (IS_ERR_OR_NULL(musb->xceiv)) |
369 | return -ENODEV; | 370 | return -ENODEV; |
370 | 371 | ||
371 | if (is_host_enabled(musb)) | 372 | if (is_host_enabled(musb)) |
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index 452940986d6d..428e6aa3e78a 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/list.h> | 15 | #include <linux/list.h> |
16 | #include <linux/gpio.h> | 16 | #include <linux/gpio.h> |
17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
18 | #include <linux/err.h> | ||
18 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
19 | #include <linux/dma-mapping.h> | 20 | #include <linux/dma-mapping.h> |
20 | #include <linux/prefetch.h> | 21 | #include <linux/prefetch.h> |
@@ -416,7 +417,7 @@ static int bfin_musb_init(struct musb *musb) | |||
416 | 417 | ||
417 | usb_nop_xceiv_register(); | 418 | usb_nop_xceiv_register(); |
418 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); | 419 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); |
419 | if (!musb->xceiv) { | 420 | if (IS_ERR_OR_NULL(musb->xceiv)) { |
420 | gpio_free(musb->config->gpio_vrsel); | 421 | gpio_free(musb->config->gpio_vrsel); |
421 | return -ENODEV; | 422 | return -ENODEV; |
422 | } | 423 | } |
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index d731c80c4fef..0f9fcec4e1d3 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/clk.h> | 31 | #include <linux/clk.h> |
32 | #include <linux/err.h> | ||
32 | #include <linux/io.h> | 33 | #include <linux/io.h> |
33 | #include <linux/platform_device.h> | 34 | #include <linux/platform_device.h> |
34 | #include <linux/dma-mapping.h> | 35 | #include <linux/dma-mapping.h> |
@@ -426,7 +427,7 @@ static int da8xx_musb_init(struct musb *musb) | |||
426 | 427 | ||
427 | usb_nop_xceiv_register(); | 428 | usb_nop_xceiv_register(); |
428 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); | 429 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); |
429 | if (!musb->xceiv) | 430 | if (IS_ERR_OR_NULL(musb->xceiv)) |
430 | goto fail; | 431 | goto fail; |
431 | 432 | ||
432 | if (is_host_enabled(musb)) | 433 | if (is_host_enabled(musb)) |
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index 582268de3fa2..f6492043655e 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/list.h> | 28 | #include <linux/list.h> |
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/clk.h> | 30 | #include <linux/clk.h> |
31 | #include <linux/err.h> | ||
31 | #include <linux/io.h> | 32 | #include <linux/io.h> |
32 | #include <linux/gpio.h> | 33 | #include <linux/gpio.h> |
33 | #include <linux/platform_device.h> | 34 | #include <linux/platform_device.h> |
@@ -385,7 +386,7 @@ static int davinci_musb_init(struct musb *musb) | |||
385 | 386 | ||
386 | usb_nop_xceiv_register(); | 387 | usb_nop_xceiv_register(); |
387 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); | 388 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); |
388 | if (!musb->xceiv) | 389 | if (IS_ERR_OR_NULL(musb->xceiv)) |
389 | goto unregister; | 390 | goto unregister; |
390 | 391 | ||
391 | musb->mregs += DAVINCI_BASE_OFFSET; | 392 | musb->mregs += DAVINCI_BASE_OFFSET; |
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 92603e498e61..217808d9fbe1 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c | |||
@@ -31,6 +31,7 @@ | |||
31 | 31 | ||
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <linux/io.h> | 33 | #include <linux/io.h> |
34 | #include <linux/err.h> | ||
34 | #include <linux/platform_device.h> | 35 | #include <linux/platform_device.h> |
35 | #include <linux/dma-mapping.h> | 36 | #include <linux/dma-mapping.h> |
36 | #include <linux/pm_runtime.h> | 37 | #include <linux/pm_runtime.h> |
@@ -377,7 +378,7 @@ static int dsps_musb_init(struct musb *musb) | |||
377 | /* NOP driver needs change if supporting dual instance */ | 378 | /* NOP driver needs change if supporting dual instance */ |
378 | usb_nop_xceiv_register(); | 379 | usb_nop_xceiv_register(); |
379 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); | 380 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); |
380 | if (!musb->xceiv) | 381 | if (IS_ERR_OR_NULL(musb->xceiv)) |
381 | return -ENODEV; | 382 | return -ENODEV; |
382 | 383 | ||
383 | /* Returns zero if e.g. not clocked */ | 384 | /* Returns zero if e.g. not clocked */ |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 2813490ba631..5fdb9da8dd56 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -320,7 +320,7 @@ static int omap2430_musb_init(struct musb *musb) | |||
320 | * which needs a driver, drivers aren't always needed. | 320 | * which needs a driver, drivers aren't always needed. |
321 | */ | 321 | */ |
322 | musb->xceiv = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); | 322 | musb->xceiv = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); |
323 | if (!musb->xceiv) { | 323 | if (IS_ERR_OR_NULL(musb->xceiv)) { |
324 | pr_err("HS USB OTG: no transceiver configured\n"); | 324 | pr_err("HS USB OTG: no transceiver configured\n"); |
325 | return -ENODEV; | 325 | return -ENODEV; |
326 | } | 326 | } |
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 8ddf3d5f7cdc..1a1bd9cf40c5 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
19 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
20 | #include <linux/err.h> | ||
20 | #include <linux/init.h> | 21 | #include <linux/init.h> |
21 | #include <linux/prefetch.h> | 22 | #include <linux/prefetch.h> |
22 | #include <linux/usb.h> | 23 | #include <linux/usb.h> |
@@ -1079,7 +1080,7 @@ static int tusb_musb_init(struct musb *musb) | |||
1079 | 1080 | ||
1080 | usb_nop_xceiv_register(); | 1081 | usb_nop_xceiv_register(); |
1081 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); | 1082 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); |
1082 | if (!musb->xceiv) | 1083 | if (IS_ERR_OR_NULL(musb->xceiv)) |
1083 | return -ENODEV; | 1084 | return -ENODEV; |
1084 | 1085 | ||
1085 | pdev = to_platform_device(musb->controller); | 1086 | pdev = to_platform_device(musb->controller); |
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c index 46cf80a8cacd..a8c0fadce1b0 100644 --- a/drivers/usb/musb/ux500.c +++ b/drivers/usb/musb/ux500.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/clk.h> | 25 | #include <linux/clk.h> |
26 | #include <linux/err.h> | ||
26 | #include <linux/io.h> | 27 | #include <linux/io.h> |
27 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
28 | 29 | ||
@@ -38,7 +39,7 @@ struct ux500_glue { | |||
38 | static int ux500_musb_init(struct musb *musb) | 39 | static int ux500_musb_init(struct musb *musb) |
39 | { | 40 | { |
40 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); | 41 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); |
41 | if (!musb->xceiv) { | 42 | if (IS_ERR_OR_NULL(musb->xceiv)) { |
42 | pr_err("HS USB OTG: no transceiver configured\n"); | 43 | pr_err("HS USB OTG: no transceiver configured\n"); |
43 | return -ENODEV; | 44 | return -ENODEV; |
44 | } | 45 | } |