diff mbox series

[v2] slimbus: Use dev_err_probe instead of dev_err

Message ID 20230726113859.4497-1-machel@vivo.com (mailing list archive)
State New, archived
Headers show
Series [v2] slimbus: Use dev_err_probe instead of dev_err | expand

Commit Message

Wang Ming July 26, 2023, 11:38 a.m. UTC
It is possible that dma_request_chan will return EPROBE_DEFER,
which means that dev is not ready yet. In this case,
dev_err(dev), there will be no output. This patch fixes the bug.

Signed-off-by: Wang Ming <machel@vivo.com>
---
 drivers/slimbus/qcom-ngd-ctrl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c
index 77aa6d26476c..d5c2a732f63f 100644
--- a/drivers/slimbus/qcom-ngd-ctrl.c
+++ b/drivers/slimbus/qcom-ngd-ctrl.c
@@ -679,8 +679,8 @@  static int qcom_slim_ngd_init_rx_msgq(struct qcom_slim_ngd_ctrl *ctrl)
 
 	ctrl->dma_rx_channel = dma_request_chan(dev, "rx");
 	if (IS_ERR(ctrl->dma_rx_channel)) {
-		dev_err(dev, "Failed to request RX dma channel");
-		ret = PTR_ERR(ctrl->dma_rx_channel);
+		ret = dev_err_probe(dev, PTR_ERR(ctrl->dma_rx_channel),
+			"Failed to request RX dma channel");
 		ctrl->dma_rx_channel = NULL;
 		return ret;
 	}
@@ -717,8 +717,8 @@  static int qcom_slim_ngd_init_tx_msgq(struct qcom_slim_ngd_ctrl *ctrl)
 
 	ctrl->dma_tx_channel = dma_request_chan(dev, "tx");
 	if (IS_ERR(ctrl->dma_tx_channel)) {
-		dev_err(dev, "Failed to request TX dma channel");
-		ret = PTR_ERR(ctrl->dma_tx_channel);
+		ret = dev_err_probe(dev, PTR_ERR(ctrl->dma_tx_channel),
+			"Failed to request TX dma channel");
 		ctrl->dma_tx_channel = NULL;
 		return ret;
 	}