* [PATCH] crypto: stm32: use of_device_get_match_data
@ 2017-09-20 18:31 Corentin Labbe
2017-10-07 4:37 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Corentin Labbe @ 2017-09-20 18:31 UTC (permalink / raw)
To: herbert, davem, mcoquelin.stm32, alexandre.torgue
Cc: linux-crypto, linux-arm-kernel, linux-kernel, Corentin Labbe
The usage of of_device_get_match_data reduce the code size a bit.
Furthermore, it prevents an improbable dereference when
of_match_device() return NULL.
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
drivers/crypto/stm32/stm32-hash.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c
index b585ce54a802..1d9285c62606 100644
--- a/drivers/crypto/stm32/stm32-hash.c
+++ b/drivers/crypto/stm32/stm32-hash.c
@@ -1408,11 +1408,10 @@ MODULE_DEVICE_TABLE(of, stm32_hash_of_match);
static int stm32_hash_get_of_match(struct stm32_hash_dev *hdev,
struct device *dev)
{
- const struct of_device_id *match;
int err;
- match = of_match_device(stm32_hash_of_match, dev);
- if (!match) {
+ hdev->pdata = of_device_get_match_data(dev);
+ if (!hdev->pdata) {
dev_err(dev, "no compatible OF match\n");
return -EINVAL;
}
@@ -1420,8 +1419,6 @@ static int stm32_hash_get_of_match(struct stm32_hash_dev *hdev,
err = of_property_read_u32(dev->of_node, "dma-maxburst",
&hdev->dma_maxburst);
- hdev->pdata = match->data;
-
return err;
}
--
2.13.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: stm32: use of_device_get_match_data
2017-09-20 18:31 [PATCH] crypto: stm32: use of_device_get_match_data Corentin Labbe
@ 2017-10-07 4:37 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2017-10-07 4:37 UTC (permalink / raw)
To: Corentin Labbe
Cc: davem, mcoquelin.stm32, alexandre.torgue, linux-crypto,
linux-arm-kernel, linux-kernel
On Wed, Sep 20, 2017 at 08:31:40PM +0200, Corentin Labbe wrote:
> The usage of of_device_get_match_data reduce the code size a bit.
> Furthermore, it prevents an improbable dereference when
> of_match_device() return NULL.
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
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] 2+ messages in thread
end of thread, other threads:[~2017-10-07 4:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-20 18:31 [PATCH] crypto: stm32: use of_device_get_match_data Corentin Labbe
2017-10-07 4:37 ` Herbert Xu
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®