diff options
author | Sonic Zhang <sonic.zhang@analog.com> | 2014-04-11 13:30:25 +0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2014-04-16 16:40:16 +0400 |
commit | 8d390395fa8cb32aeb3030398e441dd1a1ab4437 (patch) | |
tree | 91a042ed8e74da3651efba3f4469726df52fb5d3 /drivers/crypto/bfin_crc.c | |
parent | 52e6e543f2d8c8320b6e9c53110bd1c5768d6b43 (diff) | |
download | linux-8d390395fa8cb32aeb3030398e441dd1a1ab4437.tar.xz |
crypto: bfin_crc - ignore duplicated registration of the same algorithm
in case of multiple crc devices are probed.
Call platform_set_drvdata() before adding new CRC device into the list.
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/bfin_crc.c')
-rw-r--r-- | drivers/crypto/bfin_crc.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/crypto/bfin_crc.c b/drivers/crypto/bfin_crc.c index cea3e8c1fdf9..ce9a831a6c70 100644 --- a/drivers/crypto/bfin_crc.c +++ b/drivers/crypto/bfin_crc.c @@ -665,19 +665,19 @@ static int bfin_crypto_crc_probe(struct platform_device *pdev) if (timeout == 0) dev_info(&pdev->dev, "init crc poly timeout\n"); + platform_set_drvdata(pdev, crc); + spin_lock(&crc_list.lock); list_add(&crc->list, &crc_list.dev_list); spin_unlock(&crc_list.lock); - platform_set_drvdata(pdev, crc); - - ret = crypto_register_ahash(&algs); - if (ret) { - spin_lock(&crc_list.lock); - list_del(&crc->list); - spin_unlock(&crc_list.lock); - dev_err(&pdev->dev, "Cann't register crypto ahash device\n"); - goto out_error_dma; + if (list_is_singular(&crc_list.dev_list)) { + ret = crypto_register_ahash(&algs); + if (ret) { + dev_err(&pdev->dev, + "Can't register crypto ahash device\n"); + goto out_error_dma; + } } dev_info(&pdev->dev, "initialized\n"); |