[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200826144858.9584-3-krzk@kernel.org>
Date: Wed, 26 Aug 2020 16:48:56 +0200
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Pali Rohár <pali@...nel.org>,
"Andrew F. Davis" <afd@...com>, Sebastian Reichel <sre@...nel.org>,
Paul Cercueil <paul@...pouillou.net>,
David Lechner <david@...hnology.com>, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Krzysztof Kozlowski <krzk@...nel.org>
Subject: [PATCH 3/5] power: supply: gpio-charger: Simplify with dev_err_probe()
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Signed-off-by: Krzysztof Kozlowski <krzk@...nel.org>
---
drivers/power/supply/gpio-charger.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/power/supply/gpio-charger.c b/drivers/power/supply/gpio-charger.c
index 875735d50716..557f879a6499 100644
--- a/drivers/power/supply/gpio-charger.c
+++ b/drivers/power/supply/gpio-charger.c
@@ -173,10 +173,8 @@ static int gpio_charger_probe(struct platform_device *pdev)
gpio_charger->gpiod = gpio_to_desc(pdata->gpio);
} else if (IS_ERR(gpio_charger->gpiod)) {
/* Just try again if this happens */
- if (PTR_ERR(gpio_charger->gpiod) == -EPROBE_DEFER)
- return -EPROBE_DEFER;
- dev_err(dev, "error getting GPIO descriptor\n");
- return PTR_ERR(gpio_charger->gpiod);
+ return dev_err_probe(dev, PTR_ERR(gpio_charger->gpiod),
+ "error getting GPIO descriptor\n");
}
if (gpio_charger->gpiod) {
--
2.17.1
Powered by blists - more mailing lists