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/twl4030_charger.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/twl4030_charger.c')
-rw-r--r-- | drivers/power/twl4030_charger.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/power/twl4030_charger.c b/drivers/power/twl4030_charger.c index 13f9db2e8538..7cacbaa68efe 100644 --- a/drivers/power/twl4030_charger.c +++ b/drivers/power/twl4030_charger.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/err.h> | ||
18 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
19 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
20 | #include <linux/i2c/twl.h> | 21 | #include <linux/i2c/twl.h> |
@@ -480,7 +481,7 @@ static int __init twl4030_bci_probe(struct platform_device *pdev) | |||
480 | INIT_WORK(&bci->work, twl4030_bci_usb_work); | 481 | INIT_WORK(&bci->work, twl4030_bci_usb_work); |
481 | 482 | ||
482 | bci->transceiver = usb_get_phy(USB_PHY_TYPE_USB2); | 483 | bci->transceiver = usb_get_phy(USB_PHY_TYPE_USB2); |
483 | if (bci->transceiver != NULL) { | 484 | if (!IS_ERR_OR_NULL(bci->transceiver)) { |
484 | bci->usb_nb.notifier_call = twl4030_bci_usb_ncb; | 485 | bci->usb_nb.notifier_call = twl4030_bci_usb_ncb; |
485 | usb_register_notifier(bci->transceiver, &bci->usb_nb); | 486 | usb_register_notifier(bci->transceiver, &bci->usb_nb); |
486 | } | 487 | } |
@@ -507,7 +508,7 @@ static int __init twl4030_bci_probe(struct platform_device *pdev) | |||
507 | return 0; | 508 | return 0; |
508 | 509 | ||
509 | fail_unmask_interrupts: | 510 | fail_unmask_interrupts: |
510 | if (bci->transceiver != NULL) { | 511 | if (!IS_ERR_OR_NULL(bci->transceiver)) { |
511 | usb_unregister_notifier(bci->transceiver, &bci->usb_nb); | 512 | usb_unregister_notifier(bci->transceiver, &bci->usb_nb); |
512 | usb_put_phy(bci->transceiver); | 513 | usb_put_phy(bci->transceiver); |
513 | } | 514 | } |
@@ -538,7 +539,7 @@ static int __exit twl4030_bci_remove(struct platform_device *pdev) | |||
538 | twl_i2c_write_u8(TWL4030_MODULE_INTERRUPTS, 0xff, | 539 | twl_i2c_write_u8(TWL4030_MODULE_INTERRUPTS, 0xff, |
539 | TWL4030_INTERRUPTS_BCIIMR2A); | 540 | TWL4030_INTERRUPTS_BCIIMR2A); |
540 | 541 | ||
541 | if (bci->transceiver != NULL) { | 542 | if (!IS_ERR_OR_NULL(bci->transceiver)) { |
542 | usb_unregister_notifier(bci->transceiver, &bci->usb_nb); | 543 | usb_unregister_notifier(bci->transceiver, &bci->usb_nb); |
543 | usb_put_phy(bci->transceiver); | 544 | usb_put_phy(bci->transceiver); |
544 | } | 545 | } |