Linux cryptographic layer development
 help / color / mirror / Atom feed
* [PATCH v2] crypto: atmel: Use dev_err_probe instead of dev_err
@ 2023-07-26 12:04 Wang Ming
  2023-07-26 15:54 ` Ryan.Wanner
  2023-08-04  9:34 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Wang Ming @ 2023-07-26 12:04 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, linux-crypto, linux-arm-kernel, linux-kernel
  Cc: opensource.kernel, 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.

Signed-off-by: Wang Ming <machel@vivo.com>
---
 drivers/crypto/atmel-sha.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c
index 6bef634d3c86..5682957f805d 100644
--- a/drivers/crypto/atmel-sha.c
+++ b/drivers/crypto/atmel-sha.c
@@ -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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] crypto: atmel: Use dev_err_probe instead of dev_err
  2023-07-26 12:04 [PATCH v2] crypto: atmel: Use dev_err_probe instead of dev_err Wang Ming
@ 2023-07-26 15:54 ` Ryan.Wanner
  2023-08-04  9:34 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Ryan.Wanner @ 2023-07-26 15:54 UTC (permalink / raw)
  To: machel, herbert, davem, Nicolas.Ferre, alexandre.belloni,
	Claudiu.Beznea, linux-crypto, linux-arm-kernel, linux-kernel
  Cc: opensource.kernel

On 7/26/23 05:04, Wang Ming wrote:
> 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.
> 
> Signed-off-by: Wang Ming <machel@vivo.com>
Reviewed-by: Ryan Wanner <Ryan.Wanner@microchip.com>
> ---
>  drivers/crypto/atmel-sha.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c
> index 6bef634d3c86..5682957f805d 100644
> --- a/drivers/crypto/atmel-sha.c
> +++ b/drivers/crypto/atmel-sha.c
> @@ -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
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] crypto: atmel: Use dev_err_probe instead of dev_err
  2023-07-26 12:04 [PATCH v2] crypto: atmel: Use dev_err_probe instead of dev_err Wang Ming
  2023-07-26 15:54 ` Ryan.Wanner
@ 2023-08-04  9:34 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2023-08-04  9:34 UTC (permalink / raw)
  To: Wang Ming
  Cc: David S. Miller, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
	linux-crypto, linux-arm-kernel, linux-kernel, opensource.kernel

On Wed, Jul 26, 2023 at 08:04:41PM +0800, Wang Ming wrote:
> 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.
> 
> Signed-off-by: Wang Ming <machel@vivo.com>
> ---
>  drivers/crypto/atmel-sha.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-04  9:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-26 12:04 [PATCH v2] crypto: atmel: Use dev_err_probe instead of dev_err Wang Ming
2023-07-26 15:54 ` Ryan.Wanner
2023-08-04  9:34 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox