Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1538905 > unrolled thread
| Started by | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| First post | 2016-12-08 23:00 +0100 |
| Last post | 2016-12-09 03:40 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH net-next 3/3] net: xgene: avoid bogus maybe-uninitialized warning Arnd Bergmann <arnd@arndb.de> - 2016-12-08 23:00 +0100
Re: [PATCH net-next 3/3] net: xgene: avoid bogus maybe-uninitialized warning David Miller <davem@davemloft.net> - 2016-12-09 03:40 +0100
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-12-08 23:00 +0100 |
| Subject | [PATCH net-next 3/3] net: xgene: avoid bogus maybe-uninitialized warning |
| Message-ID | <sMeTo-30n-11@gated-at.bofh.it> |
In some configurations, gcc cannot trace the state of variables
across a spin_unlock() barrier, leading to a warning about
correct code:
xgene_enet_main.c: In function 'xgene_enet_start_xmit':
../../../phy/mdio-xgene.h:112:14: error: 'mss_index' may be used uninitialized in this function [-Werror=maybe-uninitialized]
Here we can trivially move the assignment before that spin_unlock,
which reliably avoids the warning.
Fixes: e3978673f514 ("drivers: net: xgene: Fix MSS programming")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 6c7eea8b36af..dba4b883e9a3 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -319,11 +319,11 @@ static int xgene_enet_setup_mss(struct net_device *ndev, u32 mss)
}
}
- spin_unlock(&pdata->mss_lock);
-
/* No slots with ref_count = 0 available, return busy */
if (!mss_index_found)
- return -EBUSY;
+ mss_index = -EBUSY;
+
+ spin_unlock(&pdata->mss_lock);
return mss_index;
}
--
2.9.0
[toc] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2016-12-09 03:40 +0100 |
| Subject | Re: [PATCH net-next 3/3] net: xgene: avoid bogus maybe-uninitialized warning |
| Message-ID | <sMjgm-5O8-11@gated-at.bofh.it> |
| In reply to | #1538905 |
From: Arnd Bergmann <arnd@arndb.de>
Date: Thu, 8 Dec 2016 22:57:05 +0100
> In some configurations, gcc cannot trace the state of variables
> across a spin_unlock() barrier, leading to a warning about
> correct code:
>
> xgene_enet_main.c: In function 'xgene_enet_start_xmit':
> ../../../phy/mdio-xgene.h:112:14: error: 'mss_index' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>
> Here we can trivially move the assignment before that spin_unlock,
> which reliably avoids the warning.
>
> Fixes: e3978673f514 ("drivers: net: xgene: Fix MSS programming")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Applied.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web