Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

spi: Use dev_err_probe instead of dev_err

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>
Link: https://lore.kernel.org/r/20230726105457.3743-1-machel@vivo.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Wang Ming and committed by
Mark Brown
893aa09e 4ee0fecc

+4 -4
+4 -4
drivers/spi/spi-bcm2835.c
··· 903 903 /* get tx/rx dma */ 904 904 ctlr->dma_tx = dma_request_chan(dev, "tx"); 905 905 if (IS_ERR(ctlr->dma_tx)) { 906 - dev_err(dev, "no tx-dma configuration found - not using dma mode\n"); 907 - ret = PTR_ERR(ctlr->dma_tx); 906 + ret = dev_err_probe(dev, PTR_ERR(ctlr->dma_tx), 907 + "no tx-dma configuration found - not using dma mode\n"); 908 908 ctlr->dma_tx = NULL; 909 909 goto err; 910 910 } 911 911 ctlr->dma_rx = dma_request_chan(dev, "rx"); 912 912 if (IS_ERR(ctlr->dma_rx)) { 913 - dev_err(dev, "no rx-dma configuration found - not using dma mode\n"); 914 - ret = PTR_ERR(ctlr->dma_rx); 913 + ret = dev_err_probe(dev, PTR_ERR(ctlr->dma_rx), 914 + "no rx-dma configuration found - not using dma mode\n"); 915 915 ctlr->dma_rx = NULL; 916 916 goto err_release; 917 917 }