aboutsummaryrefslogtreecommitdiffstats
path: root/net/caif/cfctrl.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/caif/cfctrl.c')
-rw-r--r--net/caif/cfctrl.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/caif/cfctrl.c b/net/caif/cfctrl.c
index f8ac31371a4a..e22671bed669 100644
--- a/net/caif/cfctrl.c
+++ b/net/caif/cfctrl.c
@@ -368,7 +368,8 @@ static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt)
368 cfpkt_extr_head(pkt, &cmdrsp, 1); 368 cfpkt_extr_head(pkt, &cmdrsp, 1);
369 cmd = cmdrsp & CFCTRL_CMD_MASK; 369 cmd = cmdrsp & CFCTRL_CMD_MASK;
370 if (cmd != CFCTRL_CMD_LINK_ERR 370 if (cmd != CFCTRL_CMD_LINK_ERR
371 && CFCTRL_RSP_BIT != (CFCTRL_RSP_BIT & cmdrsp)) { 371 && CFCTRL_RSP_BIT != (CFCTRL_RSP_BIT & cmdrsp)
372 && CFCTRL_ERR_BIT != (CFCTRL_ERR_BIT & cmdrsp)) {
372 if (handle_loop(cfctrl, cmd, pkt) != 0) 373 if (handle_loop(cfctrl, cmd, pkt) != 0)
373 cmdrsp |= CFCTRL_ERR_BIT; 374 cmdrsp |= CFCTRL_ERR_BIT;
374 } 375 }
@@ -604,16 +605,16 @@ static int handle_loop(struct cfctrl *ctrl, int cmd, struct cfpkt *pkt)
604 case CFCTRL_CMD_LINK_SETUP: 605 case CFCTRL_CMD_LINK_SETUP:
605 spin_lock_bh(&ctrl->loop_linkid_lock); 606 spin_lock_bh(&ctrl->loop_linkid_lock);
606 if (!dec) { 607 if (!dec) {
607 for (linkid = last_linkid + 1; linkid < 255; linkid++) 608 for (linkid = last_linkid + 1; linkid < 254; linkid++)
608 if (!ctrl->loop_linkused[linkid]) 609 if (!ctrl->loop_linkused[linkid])
609 goto found; 610 goto found;
610 } 611 }
611 dec = 1; 612 dec = 1;
612 for (linkid = last_linkid - 1; linkid > 0; linkid--) 613 for (linkid = last_linkid - 1; linkid > 1; linkid--)
613 if (!ctrl->loop_linkused[linkid]) 614 if (!ctrl->loop_linkused[linkid])
614 goto found; 615 goto found;
615 spin_unlock_bh(&ctrl->loop_linkid_lock); 616 spin_unlock_bh(&ctrl->loop_linkid_lock);
616 617 return -1;
617found: 618found:
618 if (linkid < 10) 619 if (linkid < 10)
619 dec = 0; 620 dec = 0;