Skip to contentSkip to conversation

crypto: atmel: Use dev_err_probe instead of dev_err

PATCH In review Wang Ming 3 participants 3 messages Jul 26, 2023 – Aug 4, 2023

Subsystems (2)
lore
Share & tools
lore

Wang Ming

author
#0 lore raw

PATCH v2 1/1 crypto: atmel: Use dev_err_probe instead of dev_err

It is possible that dma_request_chan will return EPROBE_DEFER, which means that dd->dev is not ready yet. In this case, dev_err(dd->dev), there will be no output. This patch fixes the bug.

---
 drivers/crypto/atmel-sha.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/atmel-sha.c +2 -2
index 6bef634d3c86..5682957f805d 100644
@@ -2499,8 +2499,8 @@ static int atmel_sha_dma_init(struct atmel_sha_dev *dd)
 {
 	dd->dma_lch_in.chan = dma_request_chan(dd->dev, "tx");
 	if (IS_ERR(dd->dma_lch_in.chan)) {
-		dev_err(dd->dev, "DMA channel is not available\n");
-		return PTR_ERR(dd->dma_lch_in.chan);
+		return dev_err_probe(dd->dev, PTR_ERR(dd->dma_lch_in.chan),
+			"DMA channel is not available\n");
 	}
 
 	dd->dma_lch_in.dma_conf.dst_addr = dd->phys_base +
Signature · 1 line
2.25.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · Wang Ming

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

It is possible that dma_request_chan will return EPROBE_DEFER, which means that dd->dev is not ready yet. In this case, dev_err(dd->dev), there will be no output. This patch fixes the bug.

Quoted 22 lines
---
 drivers/crypto/atmel-sha.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/atmel-sha.c +2 -3
index 6bef634d3c86..5682957f805d 100644
@@ -2499,8 +2499,8 @@ static int atmel_sha_dma_init(struct atmel_sha_dev *dd)
 {
        dd->dma_lch_in.chan = dma_request_chan(dd->dev, "tx");
        if (IS_ERR(dd->dma_lch_in.chan)) {
-               dev_err(dd->dev, "DMA channel is not available\n");
-               return PTR_ERR(dd->dma_lch_in.chan);
+               return dev_err_probe(dd->dev, PTR_ERR(dd->dma_lch_in.chan),
+                       "DMA channel is not available\n");
        }
 
        dd->dma_lch_in.dma_conf.dst_addr = dd->phys_base +
--

2.25.1

maintainer
#2 lore raw
In reply to Wang Ming
Quoted 8 lines · Wang Ming

It is possible that dma_request_chan will return EPROBE_DEFER, which means that dd->dev is not ready yet. In this case, dev_err(dd->dev), there will be no output. This patch fixes the bug.

---
 drivers/crypto/atmel-sha.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch applied. Thanks.

Signature · 8 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel