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/power/pda_power.c | |
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/power/pda_power.c')
-rw-r--r-- | drivers/power/pda_power.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c index 7602d49e4d81..8dbcd53c5e67 100644 --- a/drivers/power/pda_power.c +++ b/drivers/power/pda_power.c | |||
@@ -322,11 +322,11 @@ static int pda_power_probe(struct platform_device *pdev) | |||
322 | 322 | ||
323 | #ifdef CONFIG_USB_OTG_UTILS | 323 | #ifdef CONFIG_USB_OTG_UTILS |
324 | transceiver = usb_get_phy(USB_PHY_TYPE_USB2); | 324 | transceiver = usb_get_phy(USB_PHY_TYPE_USB2); |
325 | if (transceiver && !pdata->is_usb_online) { | 325 | if (!IS_ERR_OR_NULL(transceiver)) { |
326 | pdata->is_usb_online = otg_is_usb_online; | 326 | if (!pdata->is_usb_online) |
327 | } | 327 | pdata->is_usb_online = otg_is_usb_online; |
328 | if (transceiver && !pdata->is_ac_online) { | 328 | if (!pdata->is_ac_online) |
329 | pdata->is_ac_online = otg_is_ac_online; | 329 | pdata->is_ac_online = otg_is_ac_online; |
330 | } | 330 | } |
331 | #endif | 331 | #endif |
332 | 332 | ||
@@ -373,7 +373,7 @@ static int pda_power_probe(struct platform_device *pdev) | |||
373 | } | 373 | } |
374 | 374 | ||
375 | #ifdef CONFIG_USB_OTG_UTILS | 375 | #ifdef CONFIG_USB_OTG_UTILS |
376 | if (transceiver && pdata->use_otg_notifier) { | 376 | if (!IS_ERR_OR_NULL(transceiver) && pdata->use_otg_notifier) { |
377 | otg_nb.notifier_call = otg_handle_notification; | 377 | otg_nb.notifier_call = otg_handle_notification; |
378 | ret = usb_register_notifier(transceiver, &otg_nb); | 378 | ret = usb_register_notifier(transceiver, &otg_nb); |
379 | if (ret) { | 379 | if (ret) { |
@@ -408,7 +408,7 @@ usb_supply_failed: | |||
408 | if (pdata->is_ac_online && ac_irq) | 408 | if (pdata->is_ac_online && ac_irq) |
409 | free_irq(ac_irq->start, &pda_psy_ac); | 409 | free_irq(ac_irq->start, &pda_psy_ac); |
410 | #ifdef CONFIG_USB_OTG_UTILS | 410 | #ifdef CONFIG_USB_OTG_UTILS |
411 | if (transceiver) | 411 | if (!IS_ERR_OR_NULL(transceiver)) |
412 | usb_put_phy(transceiver); | 412 | usb_put_phy(transceiver); |
413 | #endif | 413 | #endif |
414 | ac_irq_failed: | 414 | ac_irq_failed: |
@@ -443,7 +443,7 @@ static int pda_power_remove(struct platform_device *pdev) | |||
443 | if (pdata->is_ac_online) | 443 | if (pdata->is_ac_online) |
444 | power_supply_unregister(&pda_psy_ac); | 444 | power_supply_unregister(&pda_psy_ac); |
445 | #ifdef CONFIG_USB_OTG_UTILS | 445 | #ifdef CONFIG_USB_OTG_UTILS |
446 | if (transceiver) | 446 | if (!IS_ERR_OR_NULL(transceiver)) |
447 | usb_put_phy(transceiver); | 447 | usb_put_phy(transceiver); |
448 | #endif | 448 | #endif |
449 | if (ac_draw) { | 449 | if (ac_draw) { |