summaryrefslogtreecommitdiff
path: root/drivers/crypto/bcm
diff options
context:
space:
mode:
authorCorentin LABBE <clabbe.montjoie@gmail.com>2017-09-20 21:47:26 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2017-10-07 07:10:35 +0300
commitd9fa482e5913213c2686404238f7f9cdb14b6c6c (patch)
tree9d9ef1b0815677d2f959d97177322d3de29017e5 /drivers/crypto/bcm
parent7d556931520e1e0df4c3e545ab8ba74046410c37 (diff)
downloadlinux-d9fa482e5913213c2686404238f7f9cdb14b6c6c.tar.xz
crypto: bcm - 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 'drivers/crypto/bcm')
-rw-r--r--drivers/crypto/bcm/cipher.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c
index 1e7924b350a7..ce70b44d0fb6 100644
--- a/drivers/crypto/bcm/cipher.c
+++ b/drivers/crypto/bcm/cipher.c
@@ -4809,7 +4809,6 @@ static int spu_dt_read(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct spu_hw *spu = &iproc_priv.spu;
struct resource *spu_ctrl_regs;
- const struct of_device_id *match;
const struct spu_type_subtype *matched_spu_type;
struct device_node *dn = pdev->dev.of_node;
int err, i;
@@ -4817,14 +4816,12 @@ static int spu_dt_read(struct platform_device *pdev)
/* Count number of mailbox channels */
spu->num_chan = of_count_phandle_with_args(dn, "mboxes", "#mbox-cells");
- match = of_match_device(of_match_ptr(bcm_spu_dt_ids), dev);
- if (!match) {
+ matched_spu_type = of_device_get_match_data(dev);
+ if (!matched_spu_type) {
dev_err(&pdev->dev, "Failed to match device\n");
return -ENODEV;
}
- matched_spu_type = match->data;
-
spu->spu_type = matched_spu_type->type;
spu->spu_subtype = matched_spu_type->subtype;