netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jia-Ju Bai <baijiaju1990@gmail.com>
To: dhowells@redhat.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jia-Ju Bai <baijiaju1990@gmail.com>
Subject: [PATCH] net: sbni: Replace mdelay with msleep in sbni_probe1
Date: Tue, 10 Apr 2018 22:22:33 +0800	[thread overview]
Message-ID: <1523370153-32354-1-git-send-email-baijiaju1990@gmail.com> (raw)

sbni_probe1() is never called in atomic context.

The call chains ending up at sbni_probe1() are:
[1] sbni_probe1() <- sbni_init() <- sbni_probe() <- net_olddevs_init()
[2] sbni_probe1() <- sbni_isa_probe() <- sbni_init() <- 
	sbni_probe() <- net_olddevs_init()
[3] sbni_probe1() <- sbni_pci_probe() <- sbni_init() <- 
	sbni_probe() <- net_olddevs_init()

net_olddevs_init() is set as a parameter of device_initcall().
This function is not called in atomic context.

Despite never getting called from atomic context, sbni_probe1()
calls mdelay() to busily wait.
This 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.
And I also manually check it.

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

diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c
index bde8c03..b7dd665 100644
--- a/drivers/net/wan/sbni.c
+++ b/drivers/net/wan/sbni.c
@@ -361,7 +361,7 @@ static int __init sbni_init(struct net_device *dev)
 		irq_mask = probe_irq_on();
 		outb( EN_INT | TR_REQ, ioaddr + CSR0 );
 		outb( PR_RES, ioaddr + CSR1 );
-		mdelay(50);
+		msleep(50);
 		irq = probe_irq_off(irq_mask);
 		outb( 0, ioaddr + CSR0 );
 
-- 
1.9.1

                 reply	other threads:[~2018-04-10 14:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1523370153-32354-1-git-send-email-baijiaju1990@gmail.com \
    --to=baijiaju1990@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).