diff options
author | Corentin LABBE <clabbe.montjoie@gmail.com> | 2017-09-20 20:42:48 +0200 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2017-10-07 06:10:35 +0200 |
commit | 7d556931520e1e0df4c3e545ab8ba74046410c37 (patch) | |
tree | 2ff27f55af9d3cfd0ab2d2e56c959dd493f5fcb3 /drivers/crypto/omap-sham.c | |
parent | crypto: stm32 - use of_device_get_match_data (diff) | |
download | linux-7d556931520e1e0df4c3e545ab8ba74046410c37.tar.xz linux-7d556931520e1e0df4c3e545ab8ba74046410c37.zip |
crypto: omap - use of_device_get_match_data
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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r-- | drivers/crypto/omap-sham.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c index c40ac30ec002..86b89ace836f 100644 --- a/drivers/crypto/omap-sham.c +++ b/drivers/crypto/omap-sham.c @@ -1944,11 +1944,10 @@ static int omap_sham_get_res_of(struct omap_sham_dev *dd, struct device *dev, struct resource *res) { struct device_node *node = dev->of_node; - const struct of_device_id *match; int err = 0; - match = of_match_device(of_match_ptr(omap_sham_of_match), dev); - if (!match) { + dd->pdata = of_device_get_match_data(dev); + if (!dd->pdata) { dev_err(dev, "no compatible OF match\n"); err = -EINVAL; goto err; @@ -1968,8 +1967,6 @@ static int omap_sham_get_res_of(struct omap_sham_dev *dd, goto err; } - dd->pdata = match->data; - err: return err; } |