Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: jme: Replace mdelay() with msleep() and usleep_range() in jme_wait_link()

jme_wait_link() is never called in atomic context.
It calls mdelay() to busily wait, which is not necessary.
mdelay() can be replaced with msleep() and usleep_range().

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

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jia-Ju Bai and committed by
David S. Miller
d818c59a 89036f23

+2 -2
+2 -2
drivers/net/ethernet/jme.c
··· 1911 1911 { 1912 1912 u32 phylink, to = JME_WAIT_LINK_TIME; 1913 1913 1914 - mdelay(1000); 1914 + msleep(1000); 1915 1915 phylink = jme_linkstat_from_phy(jme); 1916 1916 while (!(phylink & PHY_LINK_UP) && (to -= 10) > 0) { 1917 - mdelay(10); 1917 + usleep_range(10000, 11000); 1918 1918 phylink = jme_linkstat_from_phy(jme); 1919 1919 } 1920 1920 }