aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2016-01-29 06:39:14 -0500
committerDavid S. Miller <davem@davemloft.net>2016-01-29 23:33:39 -0500
commit8bdb290896d2ff22942c9c9f5bf19909329f3664 (patch)
tree6e29b42ed69a5248d89a33a54844c7c25b16cd8b
parent57e7c8cef224af166b8ec932b5e383641418c005 (diff)
net: nb8800: avoid uninitialized variable warning
The nb8800_poll() function initializes the 'next' variable in the loop looking for new input data. We know this will be called at least once because 'budget' is a guaranteed to be a positive number when we enter the function, but the compiler doesn't know that and warns when the variable is used later: drivers/net/ethernet/aurora/nb8800.c: In function 'nb8800_poll': drivers/net/ethernet/aurora/nb8800.c:350:21: warning: 'next' may be used uninitialized in this function [-Wmaybe-uninitialized] Changing the 'while() {}' loop to 'do {} while()' makes it obvious to the compiler what is going on so it no longer warns. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Mans Rullgard <mans@mansr.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/aurora/nb8800.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/aurora/nb8800.c b/drivers/net/ethernet/aurora/nb8800.c
index ecc4a334c507..f71ab2647a3b 100644
--- a/drivers/net/ethernet/aurora/nb8800.c
+++ b/drivers/net/ethernet/aurora/nb8800.c
@@ -302,7 +302,7 @@ static int nb8800_poll(struct napi_struct *napi, int budget)
302 nb8800_tx_done(dev); 302 nb8800_tx_done(dev);
303 303
304again: 304again:
305 while (work < budget) { 305 do {
306 struct nb8800_rx_buf *rxb; 306 struct nb8800_rx_buf *rxb;
307 unsigned int len; 307 unsigned int len;
308 308
@@ -330,7 +330,7 @@ again:
330 rxd->report = 0; 330 rxd->report = 0;
331 last = next; 331 last = next;
332 work++; 332 work++;
333 } 333 } while (work < budget);
334 334
335 if (work) { 335 if (work) {
336 priv->rx_descs[last].desc.config |= DESC_EOC; 336 priv->rx_descs[last].desc.config |= DESC_EOC;