Commit 8d390395 authored by Sonic Zhang's avatar Sonic Zhang Committed by Herbert Xu

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: default avatarSonic Zhang <sonic.zhang@analog.com>
Reviewed-by: default avatarMarek Vasut <marex@denx.de>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 52e6e543
...@@ -665,20 +665,20 @@ static int bfin_crypto_crc_probe(struct platform_device *pdev) ...@@ -665,20 +665,20 @@ static int bfin_crypto_crc_probe(struct platform_device *pdev)
if (timeout == 0) if (timeout == 0)
dev_info(&pdev->dev, "init crc poly timeout\n"); dev_info(&pdev->dev, "init crc poly timeout\n");
platform_set_drvdata(pdev, crc);
spin_lock(&crc_list.lock); spin_lock(&crc_list.lock);
list_add(&crc->list, &crc_list.dev_list); list_add(&crc->list, &crc_list.dev_list);
spin_unlock(&crc_list.lock); spin_unlock(&crc_list.lock);
platform_set_drvdata(pdev, crc); if (list_is_singular(&crc_list.dev_list)) {
ret = crypto_register_ahash(&algs); ret = crypto_register_ahash(&algs);
if (ret) { if (ret) {
spin_lock(&crc_list.lock); dev_err(&pdev->dev,
list_del(&crc->list); "Can't register crypto ahash device\n");
spin_unlock(&crc_list.lock);
dev_err(&pdev->dev, "Cann't register crypto ahash device\n");
goto out_error_dma; goto out_error_dma;
} }
}
dev_info(&pdev->dev, "initialized\n"); dev_info(&pdev->dev, "initialized\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment