Commit 8bdb2908 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by David S. Miller

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: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarMans Rullgard <mans@mansr.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 57e7c8ce
...@@ -302,7 +302,7 @@ static int nb8800_poll(struct napi_struct *napi, int budget) ...@@ -302,7 +302,7 @@ static int nb8800_poll(struct napi_struct *napi, int budget)
nb8800_tx_done(dev); nb8800_tx_done(dev);
again: again:
while (work < budget) { do {
struct nb8800_rx_buf *rxb; struct nb8800_rx_buf *rxb;
unsigned int len; unsigned int len;
...@@ -330,7 +330,7 @@ static int nb8800_poll(struct napi_struct *napi, int budget) ...@@ -330,7 +330,7 @@ static int nb8800_poll(struct napi_struct *napi, int budget)
rxd->report = 0; rxd->report = 0;
last = next; last = next;
work++; work++;
} } while (work < budget);
if (work) { if (work) {
priv->rx_descs[last].desc.config |= DESC_EOC; priv->rx_descs[last].desc.config |= DESC_EOC;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment