linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: "Pali Rohár" <pali@kernel.org>, "Andrew F. Davis" <afd@ti.com>,
	"Sebastian Reichel" <sre@kernel.org>,
	"Paul Cercueil" <paul@crapouillou.net>,
	"David Lechner" <david@lechnology.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Subject: [PATCH 2/5] power: supply: cpcap: Simplify with dev_err_probe()
Date: Wed, 26 Aug 2020 16:48:55 +0200	[thread overview]
Message-ID: <20200826144858.9584-2-krzk@kernel.org> (raw)
In-Reply-To: <20200826144858.9584-1-krzk@kernel.org>

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@kernel.org>
---
 drivers/power/supply/cpcap-battery.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/cpcap-battery.c
index 90eba364664b..295611b3b15e 100644
--- a/drivers/power/supply/cpcap-battery.c
+++ b/drivers/power/supply/cpcap-battery.c
@@ -747,11 +747,8 @@ static int cpcap_battery_init_iio(struct cpcap_battery_ddata *ddata)
 	return 0;
 
 out_err:
-	if (error != -EPROBE_DEFER)
-		dev_err(ddata->dev, "could not initialize VBUS or ID IIO: %i\n",
-			error);
-
-	return error;
+	return dev_err_probe(ddata->dev, error,
+			     "could not initialize VBUS or ID IIO\n");
 }
 
 /* Calibrate coulomb counter */
-- 
2.17.1


  reply	other threads:[~2020-08-26 14:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-26 14:48 [PATCH 1/5] power: supply: bq27xxx: Simplify with dev_err_probe() Krzysztof Kozlowski
2020-08-26 14:48 ` Krzysztof Kozlowski [this message]
2020-08-26 14:48 ` [PATCH 3/5] power: supply: gpio-charger: " Krzysztof Kozlowski
2020-08-26 14:48 ` [PATCH 4/5] power: supply: ingenic: " Krzysztof Kozlowski
2020-08-26 14:48 ` [PATCH 5/5] power: supply: lego_ev3: " Krzysztof Kozlowski
2020-08-26 15:11   ` David Lechner
2020-08-26 16:01     ` Sebastian Reichel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200826144858.9584-2-krzk@kernel.org \
    --to=krzk@kernel.org \
    --cc=afd@ti.com \
    --cc=david@lechnology.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pali@kernel.org \
    --cc=paul@crapouillou.net \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).