From: Sonic Zhang <sonic.adi@gmail.com>
To: Marek Vasut <marex@denx.de>, Herbert Xu <herbert@gondor.apana.org.au>
Cc: <linux-crypto@vger.kernel.org>,
<adi-buildroot-devel@lists.sourceforge.net>,
Sonic Zhang <sonic.zhang@analog.com>
Subject: [PATCH v3 1/2] crypto: bfin_crc: ignore duplicated registration of the same algorithm
Date: Fri, 11 Apr 2014 17:30:25 +0800 [thread overview]
Message-ID: <1397208625-23522-1-git-send-email-sonic.adi@gmail.com> (raw)
From: Sonic Zhang <sonic.zhang@analog.com>
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>
---
v3-change:
- check list_is_singular() before register the algorithm
drivers/crypto/bfin_crc.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/crypto/bfin_crc.c b/drivers/crypto/bfin_crc.c
index cea3e8c..892b6d2 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,
+ "Cann't register crypto ahash device\n");
+ goto out_error_dma;
+ }
}
dev_info(&pdev->dev, "initialized\n");
--
1.8.2.3
next reply other threads:[~2014-04-11 9:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-11 9:30 Sonic Zhang [this message]
2014-04-11 9:33 ` [PATCH v3 1/2] crypto: bfin_crc: ignore duplicated registration of the same algorithm Marek Vasut
2014-04-14 4:23 ` Sonic Zhang
2014-04-16 13:49 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1397208625-23522-1-git-send-email-sonic.adi@gmail.com \
--to=sonic.adi@gmail.com \
--cc=adi-buildroot-devel@lists.sourceforge.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=marex@denx.de \
--cc=sonic.zhang@analog.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox