[PATCH 2/2] firmware: imx-dsp: Use dev_err_probe() to simplify code

Yuan Can yuancan at huawei.com
Fri Sep 23 19:48:00 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/imx/imx-dsp.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/firmware/imx/imx-dsp.c b/drivers/firmware/imx/imx-dsp.c
index a6c06d7476c3..b76d01045ea8 100644
--- a/drivers/firmware/imx/imx-dsp.c
+++ b/drivers/firmware/imx/imx-dsp.c
@@ -115,10 +115,9 @@ static int imx_dsp_setup_channels(struct imx_dsp_ipc *dsp_ipc)
 		dsp_chan->idx = i % 2;
 		dsp_chan->ch = mbox_request_channel_byname(cl, chan_name);
 		if (IS_ERR(dsp_chan->ch)) {
-			ret = PTR_ERR(dsp_chan->ch);
-			if (ret != -EPROBE_DEFER)
-				dev_err(dev, "Failed to request mbox chan %s ret %d\n",
-					chan_name, ret);
+			ret = dev_err_probe(dev, PTR_ERR(dsp_chan->ch),
+					    "Failed to request mbox chan %s\n",
+					    chan_name);
 			goto out;
 		}
 
-- 
2.17.1




More information about the linux-arm-kernel mailing list