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>
This commit is contained in:
Yang Yingliang 2022-09-22 21:57:08 +08:00 committed by Greg Kroah-Hartman
parent 759fcaaf60
commit 3eab90ae9f

View File

@ -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;
}