[PATCH] firmware: arm_scmi: Use dev_err_probe() to simplify code
Yuan Can
yuancan at huawei.com
Fri Sep 23 19:51:46 PDT 2022
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 at 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
More information about the linux-arm-kernel
mailing list