summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2022-09-22 21:57:08 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-09-27 10:35:46 +0200
commit3eab90ae9f5b8e7c40a619c4c8aadf9bcd8c24cf (patch)
tree7c577f81afa04736861b3a82d07ffe75d8f52c36 /drivers/usb
parent759fcaaf600e56ec0a33678e85f317c5347562c7 (diff)
usb: typec: qcom-pmic-typec: Switch to use dev_err_probe() helper
In the probe path, dev_err() can be replaced with dev_err_probe() which will check if error code is -EPROBE_DEFER and prints the error name. It also sets the defer probe reason which can be checked later through debugfs. It's more simple in error path. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20220922135708.2212249-1-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/typec/qcom-pmic-typec.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/usb/typec/qcom-pmic-typec.c b/drivers/usb/typec/qcom-pmic-typec.c
index a0454a80c4a2..432ea62f1bab 100644
--- a/drivers/usb/typec/qcom-pmic-typec.c
+++ b/drivers/usb/typec/qcom-pmic-typec.c
@@ -195,9 +195,8 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev)
qcom_usb->role_sw = fwnode_usb_role_switch_get(dev_fwnode(qcom_usb->dev));
if (IS_ERR(qcom_usb->role_sw)) {
- if (PTR_ERR(qcom_usb->role_sw) != -EPROBE_DEFER)
- dev_err(dev, "failed to get role switch\n");
- ret = PTR_ERR(qcom_usb->role_sw);
+ ret = dev_err_probe(dev, PTR_ERR(qcom_usb->role_sw),
+ "failed to get role switch\n");
goto err_typec_port;
}