diff options
author | Joel A. Fowler <fowlerja@us.ibm.com> | 2009-03-23 23:27:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-24 18:24:31 -0400 |
commit | e2fc8cb4fedf57a63c05cd1e0f6e4f0e0238614a (patch) | |
tree | 6a1c128870d78419921db7b4b6b6522b5d398a9a /drivers/s390 | |
parent | fb8585fc3f9b39153e0bdaf03f00a02dde9c03c6 (diff) |
ctcm: fix minor findings from code analysis tool
From: Ursula Braun <ursula.braun@de.ibm.com>
This patch fixes problems in the ctcm driver identified by
static code analysis:
o remove an unnecessary always true condition in ctcm_unpack_skb
o remove duplicate assignment in ctc_mpc_alloc_channel
o remove an unnecessary always true condition in ctcmpc_send_sweep_resp
o remove duplicate initialization in ctcmpc_unpack_skb
o shorten if condition in mpc_action_go_inop
o remove INOP event if mpc group is undefined in mpc_action_doxid7
Signed-off-by: Joel A. Fowler <fowlerja@us.ibm.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/net/ctcm_main.c | 8 | ||||
-rw-r--r-- | drivers/s390/net/ctcm_mpc.c | 17 |
2 files changed, 8 insertions, 17 deletions
diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c index a7a25383db76..77f4033a0f4f 100644 --- a/drivers/s390/net/ctcm_main.c +++ b/drivers/s390/net/ctcm_main.c | |||
@@ -168,11 +168,9 @@ void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
168 | if (len > 0) { | 168 | if (len > 0) { |
169 | skb_pull(pskb, header->length); | 169 | skb_pull(pskb, header->length); |
170 | if (skb_tailroom(pskb) < LL_HEADER_LENGTH) { | 170 | if (skb_tailroom(pskb) < LL_HEADER_LENGTH) { |
171 | if (!(ch->logflags & LOG_FLAG_OVERRUN)) { | 171 | CTCM_DBF_DEV_NAME(TRACE, dev, |
172 | CTCM_DBF_DEV_NAME(TRACE, dev, | 172 | "Overrun in ctcm_unpack_skb"); |
173 | "Overrun in ctcm_unpack_skb"); | 173 | ch->logflags |= LOG_FLAG_OVERRUN; |
174 | ch->logflags |= LOG_FLAG_OVERRUN; | ||
175 | } | ||
176 | return; | 174 | return; |
177 | } | 175 | } |
178 | skb_put(pskb, LL_HEADER_LENGTH); | 176 | skb_put(pskb, LL_HEADER_LENGTH); |
diff --git a/drivers/s390/net/ctcm_mpc.c b/drivers/s390/net/ctcm_mpc.c index 3db5f846bbf6..781e18be7e8f 100644 --- a/drivers/s390/net/ctcm_mpc.c +++ b/drivers/s390/net/ctcm_mpc.c | |||
@@ -393,7 +393,6 @@ int ctc_mpc_alloc_channel(int port_num, void (*callback)(int, int)) | |||
393 | } else { | 393 | } else { |
394 | /* there are problems...bail out */ | 394 | /* there are problems...bail out */ |
395 | /* there may be a state mismatch so restart */ | 395 | /* there may be a state mismatch so restart */ |
396 | grp->port_persist = 1; | ||
397 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | 396 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); |
398 | grp->allocchan_callback_retries = 0; | 397 | grp->allocchan_callback_retries = 0; |
399 | } | 398 | } |
@@ -699,11 +698,9 @@ static void ctcmpc_send_sweep_resp(struct channel *rch) | |||
699 | return; | 698 | return; |
700 | 699 | ||
701 | done: | 700 | done: |
702 | if (rc != 0) { | 701 | grp->in_sweep = 0; |
703 | grp->in_sweep = 0; | 702 | ctcm_clear_busy_do(dev); |
704 | ctcm_clear_busy_do(dev); | 703 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); |
705 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | ||
706 | } | ||
707 | 704 | ||
708 | return; | 705 | return; |
709 | } | 706 | } |
@@ -1118,7 +1115,6 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
1118 | 1115 | ||
1119 | if (unlikely(fsm_getstate(grp->fsm) != MPCG_STATE_READY)) | 1116 | if (unlikely(fsm_getstate(grp->fsm) != MPCG_STATE_READY)) |
1120 | goto done; | 1117 | goto done; |
1121 | pdu_last_seen = 0; | ||
1122 | while ((pskb->len > 0) && !pdu_last_seen) { | 1118 | while ((pskb->len > 0) && !pdu_last_seen) { |
1123 | curr_pdu = (struct pdu *)pskb->data; | 1119 | curr_pdu = (struct pdu *)pskb->data; |
1124 | 1120 | ||
@@ -1396,8 +1392,7 @@ static void mpc_action_go_inop(fsm_instance *fi, int event, void *arg) | |||
1396 | CTCM_FUNTAIL, dev->name); | 1392 | CTCM_FUNTAIL, dev->name); |
1397 | if ((grp->saved_state != MPCG_STATE_RESET) || | 1393 | if ((grp->saved_state != MPCG_STATE_RESET) || |
1398 | /* dealloc_channel has been called */ | 1394 | /* dealloc_channel has been called */ |
1399 | ((grp->saved_state == MPCG_STATE_RESET) && | 1395 | (grp->port_persist == 0)) |
1400 | (grp->port_persist == 0))) | ||
1401 | fsm_deltimer(&priv->restart_timer); | 1396 | fsm_deltimer(&priv->restart_timer); |
1402 | 1397 | ||
1403 | wch = priv->channel[WRITE]; | 1398 | wch = priv->channel[WRITE]; |
@@ -1917,10 +1912,8 @@ static void mpc_action_doxid7(fsm_instance *fsm, int event, void *arg) | |||
1917 | 1912 | ||
1918 | if (priv) | 1913 | if (priv) |
1919 | grp = priv->mpcg; | 1914 | grp = priv->mpcg; |
1920 | if (grp == NULL) { | 1915 | if (grp == NULL) |
1921 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | ||
1922 | return; | 1916 | return; |
1923 | } | ||
1924 | 1917 | ||
1925 | for (direction = READ; direction <= WRITE; direction++) { | 1918 | for (direction = READ; direction <= WRITE; direction++) { |
1926 | struct channel *ch = priv->channel[direction]; | 1919 | struct channel *ch = priv->channel[direction]; |