Skip to content

Commit

Permalink
drivers/net/tokenring: Use status field rather than state field
Browse files Browse the repository at this point in the history
In general in this file, it is the status field, not the state field, that
contains values like OPEN and CLOSED.  Indeed, in the first error case, it
is the field status that is initialized.  I have thus assumed that all of
the error handling code should be the same, and moved it to the end of the
function to emphasize its commonality.

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Julia Lawall authored and David S. Miller committed Aug 13, 2009
1 parent 176edd5 commit 582b95c
Showing 1 changed file with 10 additions and 26 deletions.
36 changes: 10 additions & 26 deletions drivers/net/tokenring/smctr.c
Original file line number Diff line number Diff line change
Expand Up @@ -3091,61 +3091,45 @@ static int smctr_lobe_media_test(struct net_device *dev)
/* Setup the lobe media test. */
smctr_lobe_media_test_cmd(dev);
if(smctr_wait_cmd(dev))
{
smctr_reset_adapter(dev);
tp->status = CLOSED;
return (LOBE_MEDIA_TEST_FAILED);
}
goto err;

/* Tx lobe media test frames. */
for(i = 0; i < 1500; ++i)
{
if(smctr_send_lobe_media_test(dev))
{
if(perror)
{
smctr_reset_adapter(dev);
tp->state = CLOSED;
return (LOBE_MEDIA_TEST_FAILED);
}
goto err;
else
{
perror = 1;
if(smctr_lobe_media_test_cmd(dev))
{
smctr_reset_adapter(dev);
tp->state = CLOSED;
return (LOBE_MEDIA_TEST_FAILED);
}
goto err;
}
}
}

if(smctr_send_dat(dev))
{
if(smctr_send_dat(dev))
{
smctr_reset_adapter(dev);
tp->state = CLOSED;
return (LOBE_MEDIA_TEST_FAILED);
}
goto err;
}

/* Check if any frames received during test. */
if((tp->rx_fcb_curr[MAC_QUEUE]->frame_status)
|| (tp->rx_fcb_curr[NON_MAC_QUEUE]->frame_status))
{
smctr_reset_adapter(dev);
tp->state = CLOSED;
return (LOBE_MEDIA_TEST_FAILED);
}
goto err;

/* Set receive mask to "Promisc" mode. */
tp->receive_mask = saved_rcv_mask;

smctr_chg_rx_mask(dev);

return (0);
return 0;
err:
smctr_reset_adapter(dev);
tp->status = CLOSED;
return LOBE_MEDIA_TEST_FAILED;
}

static int smctr_lobe_media_test_cmd(struct net_device *dev)
Expand Down

0 comments on commit 582b95c

Please sign in to comment.