* [PATCH] drivers/net/tokenring: Use status field rather than state field
@ 2009-08-08 6:47 Julia Lawall
2009-08-13 4:19 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2009-08-08 6:47 UTC (permalink / raw)
To: netdev, linux-kernel, kernel-janitors
From: Julia Lawall <julia@diku.dk>
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>
---
drivers/net/tokenring/smctr.c | 36 +++++--------------
1 files changed, 10 insertions(+), 26 deletions(-)
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c
index 6515894..f789f51 100644
--- a/drivers/net/tokenring/smctr.c
+++ b/drivers/net/tokenring/smctr.c
@@ -3091,11 +3091,7 @@ 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)
@@ -3103,20 +3099,12 @@ static int smctr_lobe_media_test(struct net_device *dev)
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;
}
}
}
@@ -3124,28 +3112,24 @@ static int smctr_lobe_media_test(struct net_device *dev)
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)
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] drivers/net/tokenring: Use status field rather than state field
2009-08-08 6:47 [PATCH] drivers/net/tokenring: Use status field rather than state field Julia Lawall
@ 2009-08-13 4:19 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-08-13 4:19 UTC (permalink / raw)
To: julia; +Cc: netdev, linux-kernel, kernel-janitors
From: Julia Lawall <julia@diku.dk>
Date: Sat, 8 Aug 2009 08:47:33 +0200 (CEST)
> From: Julia Lawall <julia@diku.dk>
>
> 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>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-08-13 4:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-08 6:47 [PATCH] drivers/net/tokenring: Use status field rather than state field Julia Lawall
2009-08-13 4:19 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox