diff options
-rw-r--r-- | drivers/staging/cxt1e1/musycc.c | 22 | ||||
-rw-r--r-- | drivers/staging/cxt1e1/pmcc4_drv.c | 86 | ||||
-rw-r--r-- | drivers/staging/cxt1e1/sbeproc.c | 3 |
3 files changed, 63 insertions, 48 deletions
diff --git a/drivers/staging/cxt1e1/musycc.c b/drivers/staging/cxt1e1/musycc.c index b5c798a85dcc..4b3aaafc10a4 100644 --- a/drivers/staging/cxt1e1/musycc.c +++ b/drivers/staging/cxt1e1/musycc.c @@ -1045,17 +1045,19 @@ musycc_bh_rx_eom(mpi_t *pi, int gchan) #endif /*** CONFIG_SBE_WAN256T3_NCOMM ***/ { - if ((m2 = OS_mem_token_alloc(cxt1e1_max_mru))) { - /* substitute the mbuf+cluster */ - md->mem_token = m2; - md->data = cpu_to_le32(OS_vtophys(OS_mem_token_data(m2))); - - /* pass the received mbuf upward */ - sd_recv_consume(m, status & LENGTH_MASK, ch->user); - ch->s.rx_packets++; - ch->s.rx_bytes += status & LENGTH_MASK; + m2 = OS_mem_token_alloc(cxt1e1_max_mru); + if (m2) { + /* substitute the mbuf+cluster */ + md->mem_token = m2; + md->data = cpu_to_le32(OS_vtophys( + OS_mem_token_data(m2))); + + /* pass the received mbuf upward */ + sd_recv_consume(m, status & LENGTH_MASK, ch->user); + ch->s.rx_packets++; + ch->s.rx_bytes += status & LENGTH_MASK; } else - ch->s.rx_dropped++; + ch->s.rx_dropped++; } } else if (error == ERR_FCS) ch->s.rx_crc_errors++; diff --git a/drivers/staging/cxt1e1/pmcc4_drv.c b/drivers/staging/cxt1e1/pmcc4_drv.c index a9d95753be20..71702dbc98da 100644 --- a/drivers/staging/cxt1e1/pmcc4_drv.c +++ b/drivers/staging/cxt1e1/pmcc4_drv.c @@ -112,12 +112,12 @@ c4_find_chan (int channum) for (portnum = 0; portnum < ci->max_port; portnum++) for (gchan = 0; gchan < MUSYCC_NCHANS; gchan++) { - if ((ch = ci->port[portnum].chan[gchan])) - { - if ((ch->state != UNASSIGNED) && - (ch->channum == channum)) - return ch; - } + ch = ci->port[portnum].chan[gchan]; + if (ch) { + if ((ch->state != UNASSIGNED) && + (ch->channum == channum)) + return ch; + } } return NULL; } @@ -668,8 +668,9 @@ c4_init2 (ci_t *ci) status_t ret; /* PORT POINT: this routine generates first interrupt */ - if ((ret = musycc_init (ci)) != SBE_DRVR_SUCCESS) - return ret; + ret = musycc_init(ci); + if (ret != SBE_DRVR_SUCCESS) + return ret; #if 0 ci->p.framing_type = FRAMING_CBP; @@ -933,9 +934,9 @@ c4_set_port (ci_t *ci, int portnum) { status_t ret; - if ((ret = c4_wq_port_init (pi))) /* create/init - * workqueue_struct */ - return ret; + ret = c4_wq_port_init(pi); + if (ret) /* create/init workqueue_struct */ + return ret; } init_comet (ci, pi->cometbase, pp->port_mode, 1 /* clockmaster == true */ , pp->portP); @@ -1055,8 +1056,9 @@ c4_new_chan (ci_t *ci, int portnum, int channum, void *user) { status_t ret; - if ((ret = c4_wk_chan_init (pi, ch))) - return ret; + ret = c4_wk_chan_init(pi, ch); + if (ret) + return ret; } /* save off interface assignments which bound a board */ @@ -1079,8 +1081,9 @@ c4_del_chan (int channum) { mch_t *ch; - if (!(ch = c4_find_chan (channum))) - return ENOENT; + ch = c4_find_chan(channum); + if (!ch) + return -ENOENT; if (ch->state == UP) musycc_chan_down ((ci_t *) 0, channum); ch->state = UNASSIGNED; @@ -1095,8 +1098,9 @@ c4_del_chan_stats (int channum) { mch_t *ch; - if (!(ch = c4_find_chan (channum))) - return ENOENT; + ch = c4_find_chan(channum); + if (!ch) + return -ENOENT; memset (&ch->s, 0, sizeof (struct sbecom_chan_stats)); return 0; @@ -1109,8 +1113,9 @@ c4_set_chan (int channum, struct sbecom_chan_param *p) mch_t *ch; int i, x = 0; - if (!(ch = c4_find_chan (channum))) - return ENOENT; + ch = c4_find_chan(channum); + if (!ch) + return -ENOENT; #if 1 if (ch->p.card != p->card || @@ -1143,10 +1148,12 @@ c4_set_chan (int channum, struct sbecom_chan_param *p) { status_t ret; - if ((ret = musycc_chan_down ((ci_t *) 0, channum))) - return ret; - if ((ret = c4_chan_up (ch->up->up, channum))) - return ret; + ret = musycc_chan_down((ci_t *)0, channum); + if (ret) + return ret; + ret = c4_chan_up(ch->up->up, channum); + if (ret) + return ret; sd_enable_xmit (ch->user); /* re-enable to catch flow controlled * channel */ } @@ -1159,8 +1166,9 @@ c4_get_chan (int channum, struct sbecom_chan_param *p) { mch_t *ch; - if (!(ch = c4_find_chan (channum))) - return ENOENT; + ch = c4_find_chan(channum); + if (!ch) + return -ENOENT; *p = ch->p; return 0; } @@ -1170,8 +1178,9 @@ c4_get_chan_stats (int channum, struct sbecom_chan_stats *p) { mch_t *ch; - if (!(ch = c4_find_chan (channum))) - return ENOENT; + ch = c4_find_chan(channum); + if (!ch) + return -ENOENT; *p = ch->s; p->tx_pending = atomic_read (&ch->tx_pending); return 0; @@ -1240,8 +1249,9 @@ c4_chan_up (ci_t *ci, int channum) u_int32_t tmp; /* for optimizing conversion across BE * platform */ - if (!(ch = c4_find_chan (channum))) - return ENOENT; + ch = c4_find_chan(channum); + if (!ch) + return -ENOENT; if (ch->state == UP) { if (cxt1e1_log_level >= LOG_MONITOR) @@ -1372,12 +1382,13 @@ c4_chan_up (ci_t *ci, int channum) } md->next = cpu_to_le32 (OS_vtophys (md->snext)); - if (!(m = OS_mem_token_alloc (cxt1e1_max_mru))) - { - if (cxt1e1_log_level >= LOG_MONITOR) - pr_info("%s: c4_chan_up[%d] - token alloc failure, size = %d.\n", - ci->devname, channum, cxt1e1_max_mru); - goto errfree; + m = OS_mem_token_alloc(cxt1e1_max_mru); + if (!m) { + if (cxt1e1_log_level >= LOG_MONITOR) + pr_info( + "%s: c4_chan_up[%d] - token alloc failure, size = %d.\n", + ci->devname, channum, cxt1e1_max_mru); + goto errfree; } md->mem_token = m; md->data = cpu_to_le32 (OS_vtophys (OS_mem_token_data (m))); @@ -1533,8 +1544,9 @@ c4_get_iidinfo (ci_t *ci, struct sbe_iid_info *iip) struct net_device *dev; char *np; - if (!(dev = getuserbychan (iip->channum))) - return ENOENT; + dev = getuserbychan(iip->channum); + if (!dev) + return -ENOENT; np = dev->name; strncpy (iip->iname, np, CHNM_STRLEN - 1); diff --git a/drivers/staging/cxt1e1/sbeproc.c b/drivers/staging/cxt1e1/sbeproc.c index e08f79b63f1b..840c647fbf41 100644 --- a/drivers/staging/cxt1e1/sbeproc.c +++ b/drivers/staging/cxt1e1/sbeproc.c @@ -72,7 +72,8 @@ static int sbecom_proc_get_sbe_info(struct seq_file *m, void *v) char *spd; struct sbe_brd_info *bip; - if (!(bip = OS_kmalloc(sizeof(struct sbe_brd_info)))) + bip = OS_kmalloc(sizeof(struct sbe_brd_info)); + if (!bip) return -ENOMEM; pr_devel(">> sbecom_proc_get_sbe_info: entered\n"); |