diff options
author | Giuseppe Cavallaro <peppe.cavallaro@st.com> | 2010-09-05 23:02:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-09-07 16:57:14 -0400 |
commit | c4433be6e19e3680727f3f89c938a22e7b789b43 (patch) | |
tree | e5c70a0251b2da8112939cd0316061839e3242ef /drivers/net/stmmac | |
parent | 3fb5a991916091a908d53608a5899240039fb51e (diff) |
stmmac: fix sleep inside atomic
We cannot use spinlock when kmalloc is invoked with
GFP_KERNEL flag because it can sleep.
So this patch reviews the usage of spinlock within the
stmmac_resume function avoing this bug.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Reported-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/stmmac')
-rw-r--r-- | drivers/net/stmmac/stmmac_main.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c index bbb7951b9c4c..ea0461eb2dbe 100644 --- a/drivers/net/stmmac/stmmac_main.c +++ b/drivers/net/stmmac/stmmac_main.c | |||
@@ -1865,15 +1865,15 @@ static int stmmac_resume(struct platform_device *pdev) | |||
1865 | if (!netif_running(dev)) | 1865 | if (!netif_running(dev)) |
1866 | return 0; | 1866 | return 0; |
1867 | 1867 | ||
1868 | spin_lock(&priv->lock); | ||
1869 | |||
1870 | if (priv->shutdown) { | 1868 | if (priv->shutdown) { |
1871 | /* Re-open the interface and re-init the MAC/DMA | 1869 | /* Re-open the interface and re-init the MAC/DMA |
1872 | and the rings. */ | 1870 | and the rings (i.e. on hibernation stage) */ |
1873 | stmmac_open(dev); | 1871 | stmmac_open(dev); |
1874 | goto out_resume; | 1872 | return 0; |
1875 | } | 1873 | } |
1876 | 1874 | ||
1875 | spin_lock(&priv->lock); | ||
1876 | |||
1877 | /* Power Down bit, into the PM register, is cleared | 1877 | /* Power Down bit, into the PM register, is cleared |
1878 | * automatically as soon as a magic packet or a Wake-up frame | 1878 | * automatically as soon as a magic packet or a Wake-up frame |
1879 | * is received. Anyway, it's better to manually clear | 1879 | * is received. Anyway, it's better to manually clear |
@@ -1901,7 +1901,6 @@ static int stmmac_resume(struct platform_device *pdev) | |||
1901 | 1901 | ||
1902 | netif_start_queue(dev); | 1902 | netif_start_queue(dev); |
1903 | 1903 | ||
1904 | out_resume: | ||
1905 | spin_unlock(&priv->lock); | 1904 | spin_unlock(&priv->lock); |
1906 | return 0; | 1905 | return 0; |
1907 | } | 1906 | } |