Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -1045,10 +1045,12 @@ musycc_bh_rx_eom(mpi_t *pi, int gchan)
#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 */
			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 */
			sd_recv_consume(m, status & LENGTH_MASK, ch->user);
+49 −37
Original line number Diff line number Diff line
@@ -112,8 +112,8 @@ 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]))
                {
		ch = ci->port[portnum].chan[gchan];
		if (ch) {
			if ((ch->state != UNASSIGNED) &&
			   (ch->channum == channum))
				return ch;
@@ -668,7 +668,8 @@ c4_init2 (ci_t *ci)
    status_t    ret;

    /* 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;

#if 0
@@ -933,8 +934,8 @@ c4_set_port (ci_t *ci, int portnum)
    {
        status_t    ret;

        if ((ret = c4_wq_port_init (pi)))       /* create/init
                                                 * workqueue_struct */
	ret = c4_wq_port_init(pi);
	if (ret)       /* create/init workqueue_struct */
		return ret;
    }

@@ -1055,7 +1056,8 @@ c4_new_chan (ci_t *ci, int portnum, int channum, void *user)
    {
        status_t    ret;

        if ((ret = c4_wk_chan_init (pi, ch)))
	ret = c4_wk_chan_init(pi, ch);
	if (ret)
		return ret;
    }

@@ -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,9 +1148,11 @@ c4_set_chan (int channum, struct sbecom_chan_param *p)
    {
        status_t    ret;

        if ((ret = musycc_chan_down ((ci_t *) 0, channum)))
	ret = musycc_chan_down((ci_t *)0, channum);
	if (ret)
		return ret;
        if ((ret = c4_chan_up (ch->up->up, channum)))
	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,10 +1382,11 @@ 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)))
        {
	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",
			pr_info(
			"%s: c4_chan_up[%d] - token alloc failure, size = %d.\n",
			ci->devname, channum, cxt1e1_max_mru);
		goto errfree;
        }
@@ -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);
+2 −1
Original line number Diff line number Diff line
@@ -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");