From: Rosen Penev <rosenp@gmail.com>
To: linux-crypto@vger.kernel.org
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] crypto: amcc: trng: use devm_of_iomap()
Date: Wed, 12 Aug 2026 11:57:47 -0700 [thread overview]
Message-ID: <20260812185747.79173-1-rosenp@gmail.com> (raw)
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
next reply other threads:[~2026-08-12 18:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 18:57 Rosen Penev [this message]
2026-09-04 9:29 ` Herbert Xu
2026-09-04 18:36 ` Rosen Penev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260812185747.79173-1-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®