diff mbox series

[v1] spi: Use dev_err_probe instead of dev_err

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

Commit Message

Wang Ming July 19, 2023, 5:37 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/spi/spi-bcm2835.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Mark Brown July 19, 2023, 12:38 p.m. UTC | #1
On Wed, Jul 19, 2023 at 05:37:02AM +0000, 王明-软件底层技术部 wrote:

> +		ret = dev_err_probe(dev, PTR_ERR(ctlr->dma_tx),
> +							"no tx-dma configuration found - not using dma mode\n");

The indentation on the second line here is badly messed up, it's
indented far too much.  Same for the rx channel.
Wang Ming July 20, 2023, 1:01 a.m. UTC | #2
Ok, I will modify and resubmit it immediately
-----邮件原件-----
发件人: Mark Brown <broonie@kernel.org> 
发送时间: 2023年7月19日 20:38
收件人: 王明-软件底层技术部 <machel@vivo.com>
抄送: Florian Fainelli <f.fainelli@gmail.com>; Ray Jui <rjui@broadcom.com>; Scott Branden <sbranden@broadcom.com>; Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>; linux-spi@vger.kernel.org; linux-rpi-kernel@lists.infradead.org; linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; opensource.kernel <opensource.kernel@vivo.com>
主题: Re: [PATCH v1] spi: Use dev_err_probe instead of dev_err

On Wed, Jul 19, 2023 at 05:37:02AM +0000, 王明-软件底层技术部 wrote:

> +		ret = dev_err_probe(dev, PTR_ERR(ctlr->dma_tx),
> +							"no tx-dma configuration found - not using dma mode\n");

The indentation on the second line here is badly messed up, it's indented far too much.  Same for the rx channel.
diff mbox series

Patch

diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c
index 3b253da98c05..cbf025054c96 100644
--- a/drivers/spi/spi-bcm2835.c
+++ b/drivers/spi/spi-bcm2835.c
@@ -903,15 +903,15 @@  static int bcm2835_dma_init(struct spi_controller *ctlr, struct device *dev,
 	/* get tx/rx dma */
 	ctlr->dma_tx = dma_request_chan(dev, "tx");
 	if (IS_ERR(ctlr->dma_tx)) {
-		dev_err(dev, "no tx-dma configuration found - not using dma mode\n");
-		ret = PTR_ERR(ctlr->dma_tx);
+		ret = dev_err_probe(dev, PTR_ERR(ctlr->dma_tx),
+							"no tx-dma configuration found - not using dma mode\n");
 		ctlr->dma_tx = NULL;
 		goto err;
 	}
 	ctlr->dma_rx = dma_request_chan(dev, "rx");
 	if (IS_ERR(ctlr->dma_rx)) {
-		dev_err(dev, "no rx-dma configuration found - not using dma mode\n");
-		ret = PTR_ERR(ctlr->dma_rx);
+		ret = dev_err_probe(dev, PTR_ERR(ctlr->dma_rx),
+							"no rx-dma configuration found - not using dma mode\n");
 		ctlr->dma_rx = NULL;
 		goto err_release;
 	}