mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] crypto: amcc: trng: use devm_of_iomap()
@ 2026-08-12 18:57 Rosen Penev
  2026-09-04  9:29 ` Herbert Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Rosen Penev @ 2026-08-12 18:57 UTC (permalink / raw)
  To: linux-crypto; +Cc: Herbert Xu, David S. Miller, open list

Convert of_iomap() to devm_of_iomap() so that the TRNG register
mapping is automatically unmapped on driver detach, eliminating
the need for manual iounmap() calls in the error and remove paths.

Assisted-by: opencode:big-pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/crypto/amcc/crypto4xx_trng.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/crypto/amcc/crypto4xx_trng.c b/drivers/crypto/amcc/crypto4xx_trng.c
index cfd66b779ce1..4dd699c41c8a 100644
--- a/drivers/crypto/amcc/crypto4xx_trng.c
+++ b/drivers/crypto/amcc/crypto4xx_trng.c
@@ -82,9 +82,9 @@ void ppc4xx_trng_probe(struct crypto4xx_core_device *core_dev)
 		return;
 	}
 
-	dev->trng_base = of_iomap(trng, 0);
+	dev->trng_base = devm_of_iomap(core_dev->device, trng, 0, NULL);
 	of_node_put(trng);
-	if (!dev->trng_base)
+	if (IS_ERR(dev->trng_base))
 		goto err_out;
 
 	rng = kzalloc_obj(*rng);
@@ -108,9 +108,7 @@ void ppc4xx_trng_probe(struct crypto4xx_core_device *core_dev)
 	return;
 
 err_out:
-	iounmap(dev->trng_base);
 	kfree(rng);
-	dev->trng_base = NULL;
 	core_dev->trng = NULL;
 }
 
@@ -121,7 +119,6 @@ void ppc4xx_trng_remove(struct crypto4xx_core_device *core_dev)
 
 		devm_hwrng_unregister(core_dev->device, core_dev->trng);
 		ppc4xx_trng_enable(dev, false);
-		iounmap(dev->trng_base);
 		kfree(core_dev->trng);
 	}
 }
-- 
2.55.0


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

* Re: [PATCH] crypto: amcc: trng: use devm_of_iomap()
  2026-08-12 18:57 [PATCH] crypto: amcc: trng: use devm_of_iomap() Rosen Penev
@ 2026-09-04  9:29 ` Herbert Xu
  2026-09-04 18:36   ` Rosen Penev
  0 siblings, 1 reply; 3+ messages in thread
From: Herbert Xu @ 2026-09-04  9:29 UTC (permalink / raw)
  To: Rosen Penev; +Cc: linux-crypto, David S. Miller, open list

On Wed, Aug 12, 2026 at 11:57:47AM -0700, Rosen Penev wrote:
> Convert of_iomap() to devm_of_iomap() so that the TRNG register
> mapping is automatically unmapped on driver detach, eliminating
> the need for manual iounmap() calls in the error and remove paths.
> 
> Assisted-by: opencode:big-pickle
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>  drivers/crypto/amcc/crypto4xx_trng.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)

Please check Sashiko:

https://sashiko.dev/#/patchset/20260812185747.79173-1-rosenp%40gmail.com

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

* Re: [PATCH] crypto: amcc: trng: use devm_of_iomap()
  2026-09-04  9:29 ` Herbert Xu
@ 2026-09-04 18:36   ` Rosen Penev
  0 siblings, 0 replies; 3+ messages in thread
From: Rosen Penev @ 2026-09-04 18:36 UTC (permalink / raw)
  To: Herbert Xu; +Cc: linux-crypto, David S. Miller, open list

On Fri, Sep 4, 2026 at 2:29 AM Herbert Xu <herbert@gondor.apana.org.au> wrote:
>
> On Wed, Aug 12, 2026 at 11:57:47AM -0700, Rosen Penev wrote:
> > Convert of_iomap() to devm_of_iomap() so that the TRNG register
> > mapping is automatically unmapped on driver detach, eliminating
> > the need for manual iounmap() calls in the error and remove paths.
> >
> > Assisted-by: opencode:big-pickle
> > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > ---
> >  drivers/crypto/amcc/crypto4xx_trng.c | 7 ++-----
> >  1 file changed, 2 insertions(+), 5 deletions(-)
>
> Please check Sashiko:
>
> https://sashiko.dev/#/patchset/20260812185747.79173-1-rosenp%40gmail.com
>
> Thanks,
So I guess conversion from void to int is needed beforehand.
> --
> 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:[~2026-09-04 18:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-12 18:57 [PATCH] crypto: amcc: trng: use devm_of_iomap() Rosen Penev
2026-09-04  9:29 ` Herbert Xu
2026-09-04 18:36   ` Rosen Penev

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

all inboxes | Powered by JetHome®