Skip to content

Commit

Permalink
usb: common: usb-conn-gpio: use dev_err_probe() to print log
Browse files Browse the repository at this point in the history
Use dev_err_probe() to print debug or error message depending on
whether the error value is -DPROBE_DEFER or not.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1621406386-18838-2-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Chunfeng Yun authored and Greg Kroah-Hartman committed May 21, 2021
1 parent 8802879 commit ddaf0d6
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions drivers/usb/common/usb-conn-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,18 +223,14 @@ static int usb_conn_probe(struct platform_device *pdev)
}

if (IS_ERR(info->vbus)) {
if (PTR_ERR(info->vbus) != -EPROBE_DEFER)
dev_err(dev, "failed to get vbus: %ld\n", PTR_ERR(info->vbus));
return PTR_ERR(info->vbus);
ret = PTR_ERR(info->vbus);
return dev_err_probe(dev, ret, "failed to get vbus :%d\n", ret);
}

info->role_sw = usb_role_switch_get(dev);
if (IS_ERR(info->role_sw)) {
if (PTR_ERR(info->role_sw) != -EPROBE_DEFER)
dev_err(dev, "failed to get role switch\n");

return PTR_ERR(info->role_sw);
}
if (IS_ERR(info->role_sw))
return dev_err_probe(dev, PTR_ERR(info->role_sw),
"failed to get role switch\n");

ret = usb_conn_psy_register(info);
if (ret)
Expand Down

0 comments on commit ddaf0d6

Please sign in to comment.