mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
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 <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
This commit is contained in:
parent
b8a3efa3a3
commit
ded017ee6c
25 changed files with 96 additions and 77 deletions
|
|
@ -2689,7 +2689,7 @@ static int __devinit ab8500_charger_probe(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
di->usb_phy = usb_get_phy(USB_PHY_TYPE_USB2);
|
||||
if (!di->usb_phy) {
|
||||
if (IS_ERR_OR_NULL(di->usb_phy)) {
|
||||
dev_err(di->dev, "failed to get usb transceiver\n");
|
||||
ret = -EINVAL;
|
||||
goto free_usb;
|
||||
|
|
|
|||
|
|
@ -416,7 +416,7 @@ static int __devinit isp1704_charger_probe(struct platform_device *pdev)
|
|||
return -ENOMEM;
|
||||
|
||||
isp->phy = usb_get_phy(USB_PHY_TYPE_USB2);
|
||||
if (!isp->phy)
|
||||
if (IS_ERR_OR_NULL(isp->phy))
|
||||
goto fail0;
|
||||
|
||||
isp->dev = &pdev->dev;
|
||||
|
|
|
|||
|
|
@ -322,11 +322,11 @@ static int pda_power_probe(struct platform_device *pdev)
|
|||
|
||||
#ifdef CONFIG_USB_OTG_UTILS
|
||||
transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
|
||||
if (transceiver && !pdata->is_usb_online) {
|
||||
pdata->is_usb_online = otg_is_usb_online;
|
||||
}
|
||||
if (transceiver && !pdata->is_ac_online) {
|
||||
pdata->is_ac_online = otg_is_ac_online;
|
||||
if (!IS_ERR_OR_NULL(transceiver)) {
|
||||
if (!pdata->is_usb_online)
|
||||
pdata->is_usb_online = otg_is_usb_online;
|
||||
if (!pdata->is_ac_online)
|
||||
pdata->is_ac_online = otg_is_ac_online;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -373,7 +373,7 @@ static int pda_power_probe(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
#ifdef CONFIG_USB_OTG_UTILS
|
||||
if (transceiver && pdata->use_otg_notifier) {
|
||||
if (!IS_ERR_OR_NULL(transceiver) && pdata->use_otg_notifier) {
|
||||
otg_nb.notifier_call = otg_handle_notification;
|
||||
ret = usb_register_notifier(transceiver, &otg_nb);
|
||||
if (ret) {
|
||||
|
|
@ -408,7 +408,7 @@ usb_supply_failed:
|
|||
if (pdata->is_ac_online && ac_irq)
|
||||
free_irq(ac_irq->start, &pda_psy_ac);
|
||||
#ifdef CONFIG_USB_OTG_UTILS
|
||||
if (transceiver)
|
||||
if (!IS_ERR_OR_NULL(transceiver))
|
||||
usb_put_phy(transceiver);
|
||||
#endif
|
||||
ac_irq_failed:
|
||||
|
|
@ -443,7 +443,7 @@ static int pda_power_remove(struct platform_device *pdev)
|
|||
if (pdata->is_ac_online)
|
||||
power_supply_unregister(&pda_psy_ac);
|
||||
#ifdef CONFIG_USB_OTG_UTILS
|
||||
if (transceiver)
|
||||
if (!IS_ERR_OR_NULL(transceiver))
|
||||
usb_put_phy(transceiver);
|
||||
#endif
|
||||
if (ac_draw) {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/i2c/twl.h>
|
||||
|
|
@ -480,7 +481,7 @@ static int __init twl4030_bci_probe(struct platform_device *pdev)
|
|||
INIT_WORK(&bci->work, twl4030_bci_usb_work);
|
||||
|
||||
bci->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
|
||||
if (bci->transceiver != NULL) {
|
||||
if (!IS_ERR_OR_NULL(bci->transceiver)) {
|
||||
bci->usb_nb.notifier_call = twl4030_bci_usb_ncb;
|
||||
usb_register_notifier(bci->transceiver, &bci->usb_nb);
|
||||
}
|
||||
|
|
@ -507,7 +508,7 @@ static int __init twl4030_bci_probe(struct platform_device *pdev)
|
|||
return 0;
|
||||
|
||||
fail_unmask_interrupts:
|
||||
if (bci->transceiver != NULL) {
|
||||
if (!IS_ERR_OR_NULL(bci->transceiver)) {
|
||||
usb_unregister_notifier(bci->transceiver, &bci->usb_nb);
|
||||
usb_put_phy(bci->transceiver);
|
||||
}
|
||||
|
|
@ -538,7 +539,7 @@ static int __exit twl4030_bci_remove(struct platform_device *pdev)
|
|||
twl_i2c_write_u8(TWL4030_MODULE_INTERRUPTS, 0xff,
|
||||
TWL4030_INTERRUPTS_BCIIMR2A);
|
||||
|
||||
if (bci->transceiver != NULL) {
|
||||
if (!IS_ERR_OR_NULL(bci->transceiver)) {
|
||||
usb_unregister_notifier(bci->transceiver, &bci->usb_nb);
|
||||
usb_put_phy(bci->transceiver);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue