Commit 582b95c2 authored by Julia Lawall's avatar Julia Lawall Committed by David S. Miller

drivers/net/tokenring: Use status field rather than state field

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: default avatarJulia Lawall <julia@diku.dk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 176edd52
...@@ -3091,11 +3091,7 @@ static int smctr_lobe_media_test(struct net_device *dev) ...@@ -3091,11 +3091,7 @@ static int smctr_lobe_media_test(struct net_device *dev)
/* Setup the lobe media test. */ /* Setup the lobe media test. */
smctr_lobe_media_test_cmd(dev); smctr_lobe_media_test_cmd(dev);
if(smctr_wait_cmd(dev)) if(smctr_wait_cmd(dev))
{ goto err;
smctr_reset_adapter(dev);
tp->status = CLOSED;
return (LOBE_MEDIA_TEST_FAILED);
}
/* Tx lobe media test frames. */ /* Tx lobe media test frames. */
for(i = 0; i < 1500; ++i) for(i = 0; i < 1500; ++i)
...@@ -3103,20 +3099,12 @@ static int smctr_lobe_media_test(struct net_device *dev) ...@@ -3103,20 +3099,12 @@ static int smctr_lobe_media_test(struct net_device *dev)
if(smctr_send_lobe_media_test(dev)) if(smctr_send_lobe_media_test(dev))
{ {
if(perror) if(perror)
{ goto err;
smctr_reset_adapter(dev);
tp->state = CLOSED;
return (LOBE_MEDIA_TEST_FAILED);
}
else else
{ {
perror = 1; perror = 1;
if(smctr_lobe_media_test_cmd(dev)) if(smctr_lobe_media_test_cmd(dev))
{ goto err;
smctr_reset_adapter(dev);
tp->state = CLOSED;
return (LOBE_MEDIA_TEST_FAILED);
}
} }
} }
} }
...@@ -3124,28 +3112,24 @@ static int smctr_lobe_media_test(struct net_device *dev) ...@@ -3124,28 +3112,24 @@ static int smctr_lobe_media_test(struct net_device *dev)
if(smctr_send_dat(dev)) if(smctr_send_dat(dev))
{ {
if(smctr_send_dat(dev)) if(smctr_send_dat(dev))
{ goto err;
smctr_reset_adapter(dev);
tp->state = CLOSED;
return (LOBE_MEDIA_TEST_FAILED);
}
} }
/* Check if any frames received during test. */ /* Check if any frames received during test. */
if((tp->rx_fcb_curr[MAC_QUEUE]->frame_status) if((tp->rx_fcb_curr[MAC_QUEUE]->frame_status)
|| (tp->rx_fcb_curr[NON_MAC_QUEUE]->frame_status)) || (tp->rx_fcb_curr[NON_MAC_QUEUE]->frame_status))
{ goto err;
smctr_reset_adapter(dev);
tp->state = CLOSED;
return (LOBE_MEDIA_TEST_FAILED);
}
/* Set receive mask to "Promisc" mode. */ /* Set receive mask to "Promisc" mode. */
tp->receive_mask = saved_rcv_mask; tp->receive_mask = saved_rcv_mask;
smctr_chg_rx_mask(dev); 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) static int smctr_lobe_media_test_cmd(struct net_device *dev)
......
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