Commit d0f66810 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Chanwoo Choi

extcon: palmas: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and the error value gets printed.
Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
parent ce90c3c9
...@@ -205,21 +205,15 @@ static int palmas_usb_probe(struct platform_device *pdev) ...@@ -205,21 +205,15 @@ static int palmas_usb_probe(struct platform_device *pdev)
palmas_usb->id_gpiod = devm_gpiod_get_optional(&pdev->dev, "id", palmas_usb->id_gpiod = devm_gpiod_get_optional(&pdev->dev, "id",
GPIOD_IN); GPIOD_IN);
if (PTR_ERR(palmas_usb->id_gpiod) == -EPROBE_DEFER) { if (IS_ERR(palmas_usb->id_gpiod))
return -EPROBE_DEFER; return dev_err_probe(&pdev->dev, PTR_ERR(palmas_usb->id_gpiod),
} else if (IS_ERR(palmas_usb->id_gpiod)) { "failed to get id gpio\n");
dev_err(&pdev->dev, "failed to get id gpio\n");
return PTR_ERR(palmas_usb->id_gpiod);
}
palmas_usb->vbus_gpiod = devm_gpiod_get_optional(&pdev->dev, "vbus", palmas_usb->vbus_gpiod = devm_gpiod_get_optional(&pdev->dev, "vbus",
GPIOD_IN); GPIOD_IN);
if (PTR_ERR(palmas_usb->vbus_gpiod) == -EPROBE_DEFER) { if (IS_ERR(palmas_usb->vbus_gpiod))
return -EPROBE_DEFER; return dev_err_probe(&pdev->dev, PTR_ERR(palmas_usb->vbus_gpiod),
} else if (IS_ERR(palmas_usb->vbus_gpiod)) { "failed to get id gpio\n");
dev_err(&pdev->dev, "failed to get vbus gpio\n");
return PTR_ERR(palmas_usb->vbus_gpiod);
}
if (palmas_usb->enable_id_detection && palmas_usb->id_gpiod) { if (palmas_usb->enable_id_detection && palmas_usb->id_gpiod) {
palmas_usb->enable_id_detection = false; palmas_usb->enable_id_detection = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment