summaryrefslogtreecommitdiffstats
path: root/drivers/extcon
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzk@kernel.org>2020-08-28 17:13:37 +0200
committerChanwoo Choi <cw00.choi@samsung.com>2020-09-24 19:20:49 +0900
commitd0f668101713bd029e7d19a4fe9ddab9a33c8f85 (patch)
tree807f06c53c113adb3764f53c86235ad89a68a12e /drivers/extcon
parentce90c3c9b3ab2e25530a9bb313f3c51718d5d96b (diff)
downloadlinux-d0f668101713bd029e7d19a4fe9ddab9a33c8f85.tar.bz2
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: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/extcon')
-rw-r--r--drivers/extcon/extcon-palmas.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c
index e8e9eebe6b1d..a2852bcc5f0d 100644
--- a/drivers/extcon/extcon-palmas.c
+++ b/drivers/extcon/extcon-palmas.c
@@ -205,21 +205,15 @@ static int palmas_usb_probe(struct platform_device *pdev)
palmas_usb->id_gpiod = devm_gpiod_get_optional(&pdev->dev, "id",
GPIOD_IN);
- if (PTR_ERR(palmas_usb->id_gpiod) == -EPROBE_DEFER) {
- return -EPROBE_DEFER;
- } else if (IS_ERR(palmas_usb->id_gpiod)) {
- dev_err(&pdev->dev, "failed to get id gpio\n");
- return PTR_ERR(palmas_usb->id_gpiod);
- }
+ if (IS_ERR(palmas_usb->id_gpiod))
+ return dev_err_probe(&pdev->dev, PTR_ERR(palmas_usb->id_gpiod),
+ "failed to get id gpio\n");
palmas_usb->vbus_gpiod = devm_gpiod_get_optional(&pdev->dev, "vbus",
GPIOD_IN);
- if (PTR_ERR(palmas_usb->vbus_gpiod) == -EPROBE_DEFER) {
- return -EPROBE_DEFER;
- } else if (IS_ERR(palmas_usb->vbus_gpiod)) {
- dev_err(&pdev->dev, "failed to get vbus gpio\n");
- return PTR_ERR(palmas_usb->vbus_gpiod);
- }
+ if (IS_ERR(palmas_usb->vbus_gpiod))
+ return dev_err_probe(&pdev->dev, PTR_ERR(palmas_usb->vbus_gpiod),
+ "failed to get id gpio\n");
if (palmas_usb->enable_id_detection && palmas_usb->id_gpiod) {
palmas_usb->enable_id_detection = false;