Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Joel A. Fowler and committed by
David S. Miller
e2fc8cb4 fb8585fc

+8 -17
+3 -5
drivers/s390/net/ctcm_main.c
··· 168 168 if (len > 0) { 169 169 skb_pull(pskb, header->length); 170 170 if (skb_tailroom(pskb) < LL_HEADER_LENGTH) { 171 - if (!(ch->logflags & LOG_FLAG_OVERRUN)) { 172 - CTCM_DBF_DEV_NAME(TRACE, dev, 173 - "Overrun in ctcm_unpack_skb"); 174 - ch->logflags |= LOG_FLAG_OVERRUN; 175 - } 171 + CTCM_DBF_DEV_NAME(TRACE, dev, 172 + "Overrun in ctcm_unpack_skb"); 173 + ch->logflags |= LOG_FLAG_OVERRUN; 176 174 return; 177 175 } 178 176 skb_put(pskb, LL_HEADER_LENGTH);
+5 -12
drivers/s390/net/ctcm_mpc.c
··· 393 393 } else { 394 394 /* there are problems...bail out */ 395 395 /* there may be a state mismatch so restart */ 396 - grp->port_persist = 1; 397 396 fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); 398 397 grp->allocchan_callback_retries = 0; 399 398 } ··· 698 699 return; 699 700 700 701 done: 701 - if (rc != 0) { 702 - grp->in_sweep = 0; 703 - ctcm_clear_busy_do(dev); 704 - fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); 705 - } 702 + grp->in_sweep = 0; 703 + ctcm_clear_busy_do(dev); 704 + fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); 706 705 707 706 return; 708 707 } ··· 1115 1118 1116 1119 if (unlikely(fsm_getstate(grp->fsm) != MPCG_STATE_READY)) 1117 1120 goto done; 1118 - pdu_last_seen = 0; 1119 1121 while ((pskb->len > 0) && !pdu_last_seen) { 1120 1122 curr_pdu = (struct pdu *)pskb->data; 1121 1123 ··· 1392 1396 CTCM_FUNTAIL, dev->name); 1393 1397 if ((grp->saved_state != MPCG_STATE_RESET) || 1394 1398 /* dealloc_channel has been called */ 1395 - ((grp->saved_state == MPCG_STATE_RESET) && 1396 - (grp->port_persist == 0))) 1399 + (grp->port_persist == 0)) 1397 1400 fsm_deltimer(&priv->restart_timer); 1398 1401 1399 1402 wch = priv->channel[WRITE]; ··· 1912 1917 1913 1918 if (priv) 1914 1919 grp = priv->mpcg; 1915 - if (grp == NULL) { 1916 - fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); 1920 + if (grp == NULL) 1917 1921 return; 1918 - } 1919 1922 1920 1923 for (direction = READ; direction <= WRITE; direction++) { 1921 1924 struct channel *ch = priv->channel[direction];