Re: [PATCH 1/4] silicom: checkpatch: assignments in if conditions

From: Joe Perches
Date: Mon Jun 17 2013 - 13:42:13 EST


On Mon, 2013-06-17 at 20:22 +0300, Dan Carpenter wrote:
> This will need to be redone because there were some buggy extra
> lines added toward the end of the patch.

[]

> > @@ -4867,10 +4884,12 @@ int set_tx_fn(bpctl_dev_t *pbpctl_dev, int tx_state)
> > (pbpctl_dev->bp_caps & SW_CTL_CAP)) {
> > if ((pbpctl_dev->bp_tpl_flag))
> > return BP_NOT_CAP;
> > - } else if ((pbpctl_dev_b = get_master_port_fn(pbpctl_dev))) {
> > - if ((pbpctl_dev_b->bp_caps & TPL_CAP) &&
> > - (pbpctl_dev_b->bp_tpl_flag))
> > - return BP_NOT_CAP;
> > + } else {
> > + pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
> > + if (pbpctl_dev_b)
> > + if ((pbpctl_dev_b->bp_caps & TPL_CAP) &&
> > + (pbpctl_dev_b->bp_tpl_flag))
> > + return BP_NOT_CAP;
>
> Please put curly brace {} around multi-line indents. Even though
> they are not needed for semantic reasons they make the code more
> readable.

Better still would be to combine the multi-statement ifs
into a single test and avoid the braces altogether.

if (pbpctl_dev_b &&
pbpctl_dev_b->bp_caps & TPL_CAP &&
pbpctl_dev_b->bp_tpl_flag)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/