public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Yuan Can <yuancan@huawei.com>
To: <sudeep.holla@arm.com>, <cristian.marussi@arm.com>,
	<linux-arm-kernel@lists.infradead.org>
Cc: <yuancan@huawei.com>
Subject: [PATCH] firmware: arm_scmi: Use dev_err_probe() to simplify code
Date: Sat, 24 Sep 2022 02:51:46 +0000	[thread overview]
Message-ID: <20220924025146.34976-1-yuancan@huawei.com> (raw)

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.

Signed-off-by: Yuan Can <yuancan@huawei.com>
---
 drivers/firmware/arm_scmi/mailbox.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/firmware/arm_scmi/mailbox.c b/drivers/firmware/arm_scmi/mailbox.c
index 08ff4d110beb..85b84be85458 100644
--- a/drivers/firmware/arm_scmi/mailbox.c
+++ b/drivers/firmware/arm_scmi/mailbox.c
@@ -94,13 +94,10 @@ static int mailbox_chan_setup(struct scmi_chan_info *cinfo, struct device *dev,
 	cl->knows_txdone = tx;
 
 	smbox->chan = mbox_request_channel(cl, tx ? 0 : 1);
-	if (IS_ERR(smbox->chan)) {
-		ret = PTR_ERR(smbox->chan);
-		if (ret != -EPROBE_DEFER)
-			dev_err(cdev, "failed to request SCMI %s mailbox\n",
-				tx ? "Tx" : "Rx");
-		return ret;
-	}
+	if (IS_ERR(smbox->chan))
+		return dev_err_probe(cdev, PTR_ERR(smbox->chan),
+				     "failed to request SCMI %s mailbox\n",
+				     tx ? "Tx" : "Rx");
 
 	cinfo->transport_info = smbox;
 	smbox->cinfo = cinfo;
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2022-09-24  2:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-24  2:51 Yuan Can [this message]
2022-09-26 10:50 ` [PATCH] firmware: arm_scmi: Use dev_err_probe() to simplify code Cristian Marussi

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=20220924025146.34976-1-yuancan@huawei.com \
    --to=yuancan@huawei.com \
    --cc=cristian.marussi@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=sudeep.holla@arm.com \
    /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