Commit 24e7d799 authored by Chi Pham's avatar Chi Pham Committed by Peter P Waskiewicz Jr

staging: cxt1e1: Removed assignments from if statements.

Assignments removed from if statements.
Fixed checkpatch warning such as indentation and negative error returns in
adjacent code.

Coccinelle was used for this patch. The following script found the match:
@simple@
expression E1, E2;
statement S1, S2;
@@

+ E1 = E2;
  if (
-     (E1 = E2)
+     E1
     )
  S1 else S2

@left@
expression E0, E1, E2;
statement S1, S2;
@@

+ E1 = E2;
  if (
-     (E1 = E2)
+     E1
         == E0
     )
  S1 else S2
Signed-off-by: default avatarChi Pham <fempsci@gmail.com>
Signed-off-by: default avatarPeter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
parent 5a9e30ee
...@@ -1045,10 +1045,12 @@ musycc_bh_rx_eom(mpi_t *pi, int gchan) ...@@ -1045,10 +1045,12 @@ musycc_bh_rx_eom(mpi_t *pi, int gchan)
#endif /*** CONFIG_SBE_WAN256T3_NCOMM ***/ #endif /*** CONFIG_SBE_WAN256T3_NCOMM ***/
{ {
if ((m2 = OS_mem_token_alloc(cxt1e1_max_mru))) { m2 = OS_mem_token_alloc(cxt1e1_max_mru);
if (m2) {
/* substitute the mbuf+cluster */ /* substitute the mbuf+cluster */
md->mem_token = m2; md->mem_token = m2;
md->data = cpu_to_le32(OS_vtophys(OS_mem_token_data(m2))); md->data = cpu_to_le32(OS_vtophys(
OS_mem_token_data(m2)));
/* pass the received mbuf upward */ /* pass the received mbuf upward */
sd_recv_consume(m, status & LENGTH_MASK, ch->user); sd_recv_consume(m, status & LENGTH_MASK, ch->user);
......
...@@ -112,8 +112,8 @@ c4_find_chan (int channum) ...@@ -112,8 +112,8 @@ c4_find_chan (int channum)
for (portnum = 0; portnum < ci->max_port; portnum++) for (portnum = 0; portnum < ci->max_port; portnum++)
for (gchan = 0; gchan < MUSYCC_NCHANS; gchan++) for (gchan = 0; gchan < MUSYCC_NCHANS; gchan++)
{ {
if ((ch = ci->port[portnum].chan[gchan])) ch = ci->port[portnum].chan[gchan];
{ if (ch) {
if ((ch->state != UNASSIGNED) && if ((ch->state != UNASSIGNED) &&
(ch->channum == channum)) (ch->channum == channum))
return ch; return ch;
...@@ -668,7 +668,8 @@ c4_init2 (ci_t *ci) ...@@ -668,7 +668,8 @@ c4_init2 (ci_t *ci)
status_t ret; status_t ret;
/* PORT POINT: this routine generates first interrupt */ /* PORT POINT: this routine generates first interrupt */
if ((ret = musycc_init (ci)) != SBE_DRVR_SUCCESS) ret = musycc_init(ci);
if (ret != SBE_DRVR_SUCCESS)
return ret; return ret;
#if 0 #if 0
...@@ -933,8 +934,8 @@ c4_set_port (ci_t *ci, int portnum) ...@@ -933,8 +934,8 @@ c4_set_port (ci_t *ci, int portnum)
{ {
status_t ret; status_t ret;
if ((ret = c4_wq_port_init (pi))) /* create/init ret = c4_wq_port_init(pi);
* workqueue_struct */ if (ret) /* create/init workqueue_struct */
return ret; return ret;
} }
...@@ -1055,7 +1056,8 @@ c4_new_chan (ci_t *ci, int portnum, int channum, void *user) ...@@ -1055,7 +1056,8 @@ c4_new_chan (ci_t *ci, int portnum, int channum, void *user)
{ {
status_t ret; status_t ret;
if ((ret = c4_wk_chan_init (pi, ch))) ret = c4_wk_chan_init(pi, ch);
if (ret)
return ret; return ret;
} }
...@@ -1079,8 +1081,9 @@ c4_del_chan (int channum) ...@@ -1079,8 +1081,9 @@ c4_del_chan (int channum)
{ {
mch_t *ch; mch_t *ch;
if (!(ch = c4_find_chan (channum))) ch = c4_find_chan(channum);
return ENOENT; if (!ch)
return -ENOENT;
if (ch->state == UP) if (ch->state == UP)
musycc_chan_down ((ci_t *) 0, channum); musycc_chan_down ((ci_t *) 0, channum);
ch->state = UNASSIGNED; ch->state = UNASSIGNED;
...@@ -1095,8 +1098,9 @@ c4_del_chan_stats (int channum) ...@@ -1095,8 +1098,9 @@ c4_del_chan_stats (int channum)
{ {
mch_t *ch; mch_t *ch;
if (!(ch = c4_find_chan (channum))) ch = c4_find_chan(channum);
return ENOENT; if (!ch)
return -ENOENT;
memset (&ch->s, 0, sizeof (struct sbecom_chan_stats)); memset (&ch->s, 0, sizeof (struct sbecom_chan_stats));
return 0; return 0;
...@@ -1109,8 +1113,9 @@ c4_set_chan (int channum, struct sbecom_chan_param *p) ...@@ -1109,8 +1113,9 @@ c4_set_chan (int channum, struct sbecom_chan_param *p)
mch_t *ch; mch_t *ch;
int i, x = 0; int i, x = 0;
if (!(ch = c4_find_chan (channum))) ch = c4_find_chan(channum);
return ENOENT; if (!ch)
return -ENOENT;
#if 1 #if 1
if (ch->p.card != p->card || if (ch->p.card != p->card ||
...@@ -1143,9 +1148,11 @@ c4_set_chan (int channum, struct sbecom_chan_param *p) ...@@ -1143,9 +1148,11 @@ c4_set_chan (int channum, struct sbecom_chan_param *p)
{ {
status_t ret; status_t ret;
if ((ret = musycc_chan_down ((ci_t *) 0, channum))) ret = musycc_chan_down((ci_t *)0, channum);
if (ret)
return ret; return ret;
if ((ret = c4_chan_up (ch->up->up, channum))) ret = c4_chan_up(ch->up->up, channum);
if (ret)
return ret; return ret;
sd_enable_xmit (ch->user); /* re-enable to catch flow controlled sd_enable_xmit (ch->user); /* re-enable to catch flow controlled
* channel */ * channel */
...@@ -1159,8 +1166,9 @@ c4_get_chan (int channum, struct sbecom_chan_param *p) ...@@ -1159,8 +1166,9 @@ c4_get_chan (int channum, struct sbecom_chan_param *p)
{ {
mch_t *ch; mch_t *ch;
if (!(ch = c4_find_chan (channum))) ch = c4_find_chan(channum);
return ENOENT; if (!ch)
return -ENOENT;
*p = ch->p; *p = ch->p;
return 0; return 0;
} }
...@@ -1170,8 +1178,9 @@ c4_get_chan_stats (int channum, struct sbecom_chan_stats *p) ...@@ -1170,8 +1178,9 @@ c4_get_chan_stats (int channum, struct sbecom_chan_stats *p)
{ {
mch_t *ch; mch_t *ch;
if (!(ch = c4_find_chan (channum))) ch = c4_find_chan(channum);
return ENOENT; if (!ch)
return -ENOENT;
*p = ch->s; *p = ch->s;
p->tx_pending = atomic_read (&ch->tx_pending); p->tx_pending = atomic_read (&ch->tx_pending);
return 0; return 0;
...@@ -1240,8 +1249,9 @@ c4_chan_up (ci_t *ci, int channum) ...@@ -1240,8 +1249,9 @@ c4_chan_up (ci_t *ci, int channum)
u_int32_t tmp; /* for optimizing conversion across BE u_int32_t tmp; /* for optimizing conversion across BE
* platform */ * platform */
if (!(ch = c4_find_chan (channum))) ch = c4_find_chan(channum);
return ENOENT; if (!ch)
return -ENOENT;
if (ch->state == UP) if (ch->state == UP)
{ {
if (cxt1e1_log_level >= LOG_MONITOR) if (cxt1e1_log_level >= LOG_MONITOR)
...@@ -1372,10 +1382,11 @@ c4_chan_up (ci_t *ci, int channum) ...@@ -1372,10 +1382,11 @@ c4_chan_up (ci_t *ci, int channum)
} }
md->next = cpu_to_le32 (OS_vtophys (md->snext)); md->next = cpu_to_le32 (OS_vtophys (md->snext));
if (!(m = OS_mem_token_alloc (cxt1e1_max_mru))) m = OS_mem_token_alloc(cxt1e1_max_mru);
{ if (!m) {
if (cxt1e1_log_level >= LOG_MONITOR) if (cxt1e1_log_level >= LOG_MONITOR)
pr_info("%s: c4_chan_up[%d] - token alloc failure, size = %d.\n", pr_info(
"%s: c4_chan_up[%d] - token alloc failure, size = %d.\n",
ci->devname, channum, cxt1e1_max_mru); ci->devname, channum, cxt1e1_max_mru);
goto errfree; goto errfree;
} }
...@@ -1533,8 +1544,9 @@ c4_get_iidinfo (ci_t *ci, struct sbe_iid_info *iip) ...@@ -1533,8 +1544,9 @@ c4_get_iidinfo (ci_t *ci, struct sbe_iid_info *iip)
struct net_device *dev; struct net_device *dev;
char *np; char *np;
if (!(dev = getuserbychan (iip->channum))) dev = getuserbychan(iip->channum);
return ENOENT; if (!dev)
return -ENOENT;
np = dev->name; np = dev->name;
strncpy (iip->iname, np, CHNM_STRLEN - 1); strncpy (iip->iname, np, CHNM_STRLEN - 1);
......
...@@ -72,7 +72,8 @@ static int sbecom_proc_get_sbe_info(struct seq_file *m, void *v) ...@@ -72,7 +72,8 @@ static int sbecom_proc_get_sbe_info(struct seq_file *m, void *v)
char *spd; char *spd;
struct sbe_brd_info *bip; 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; return -ENOMEM;
pr_devel(">> sbecom_proc_get_sbe_info: entered\n"); pr_devel(">> sbecom_proc_get_sbe_info: entered\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment