All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: cavium: cpt: Replace mdelay with msleep in cpt_device_init
@ 2018-03-18 14:50 Jia-Ju Bai
  2018-03-23 16:04 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2018-03-18 14:50 UTC (permalink / raw)
  To: george.cherian, herbert, davem; +Cc: linux-crypto, linux-kernel, Jia-Ju Bai

cpt_device_init() is never called in atomic context.

The call chain ending up at cpt_device_init() is:
[1] cpt_device_init() <- cpt_probe()
cpt_probe() is only set as ".probe" in pci_driver structure 
"cpt_pci_driver".

Despite never getting called from atomic context, cpt_device_init() calls
mdelay(100), i.e. busy wait for 100ms.
That is not necessary and can be replaced with msleep to 
avoid busy waiting.

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 drivers/crypto/cavium/cpt/cptpf_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/cavium/cpt/cptpf_main.c b/drivers/crypto/cavium/cpt/cptpf_main.c
index 34a6d8b..06ad85a 100644
--- a/drivers/crypto/cavium/cpt/cptpf_main.c
+++ b/drivers/crypto/cavium/cpt/cptpf_main.c
@@ -436,7 +436,7 @@ static int cpt_device_init(struct cpt_device *cpt)
 
 	/* Reset the PF when probed first */
 	cpt_reset(cpt);
-	mdelay(100);
+	msleep(100);
 
 	/*Check BIST status*/
 	bist = (u64)cpt_check_bist_status(cpt);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] crypto: cavium: cpt: Replace mdelay with msleep in cpt_device_init
  2018-03-18 14:50 [PATCH] crypto: cavium: cpt: Replace mdelay with msleep in cpt_device_init Jia-Ju Bai
@ 2018-03-23 16:04 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2018-03-23 16:04 UTC (permalink / raw)
  To: Jia-Ju Bai; +Cc: george.cherian, davem, linux-crypto, linux-kernel

On Sun, Mar 18, 2018 at 10:50:38PM +0800, Jia-Ju Bai wrote:
> cpt_device_init() is never called in atomic context.
> 
> The call chain ending up at cpt_device_init() is:
> [1] cpt_device_init() <- cpt_probe()
> cpt_probe() is only set as ".probe" in pci_driver structure 
> "cpt_pci_driver".
> 
> Despite never getting called from atomic context, cpt_device_init() calls
> mdelay(100), i.e. busy wait for 100ms.
> That is not necessary and can be replaced with msleep to 
> avoid busy waiting.
> 
> This is found by a static analysis tool named DCNS written by myself.
> 
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-23 16:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-18 14:50 [PATCH] crypto: cavium: cpt: Replace mdelay with msleep in cpt_device_init Jia-Ju Bai
2018-03-23 16:04 ` Herbert Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.