public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Lorenz Haspel <lorenz@badgers.com>
Cc: devel@linuxdriverproject.org, gregkh@linuxfoundation.org,
	puff65537@bansheeslibrary.com, viro@zeniv.linux.org.uk,
	michael.banken@mathe.stud.uni-erlangen.de,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	linux-kernel@i4.informatik.uni-erlangen.de
Subject: Re: [PATCH 1/4] silicom: checkpatch: assignments in if conditions
Date: Mon, 17 Jun 2013 20:22:46 +0300	[thread overview]
Message-ID: <20130617172246.GI5008@mwanda> (raw)
In-Reply-To: <1371486386-8043-1-git-send-email-lorenz@badgers.com>

This will need to be redone because there were some buggy extra
lines added toward the end of the patch.

On Mon, Jun 17, 2013 at 06:26:23PM +0200, Lorenz Haspel wrote:
> @@ -1743,8 +1750,8 @@ static void write_data_port_int(bpctl_dev_t *pbpctl_dev,
>  static int write_data_int(bpctl_dev_t *pbpctl_dev, unsigned char value)
>  {
>  	bpctl_dev_t *pbpctl_dev_b = NULL;
> -

This blank line is needed.  (Put a blank line between declarations
and code).

> -	if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev)))
> +	pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
> +	if (!pbpctl_dev_b)
>  		return -1;
>  	atomic_set(&pbpctl_dev->wdt_busy, 1);
>  	write_data_port_int(pbpctl_dev, value & 0x3);
> @@ -1965,7 +1972,8 @@ int tpl_hw_on(bpctl_dev_t *pbpctl_dev)
>  	int ret = 0, ctrl = 0;
>  	bpctl_dev_t *pbpctl_dev_b = NULL;
>  
> -	if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev)))
> +	pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
> +	if (!pbpctl_dev_b)
>  		return BP_NOT_CAP;
>  
>  	if (pbpctl_dev->bp_caps_ex & TPL2_CAP_EX) {

> @@ -1991,8 +1999,8 @@ int tpl_hw_off(bpctl_dev_t *pbpctl_dev)
>  {
>  	int ret = 0, ctrl = 0;
>  	bpctl_dev_t *pbpctl_dev_b = NULL;
> -

Same for this blank line and all the following instances.

> -	if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev)))
> +	pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
> +	if (!pbpctl_dev_b)
>  		return BP_NOT_CAP;
>  	if (pbpctl_dev->bp_caps_ex & TPL2_CAP_EX) {
>  		cmnd_on(pbpctl_dev);

> @@ -4461,11 +4472,13 @@ int set_bypass_pwoff_fn(bpctl_dev_t *pbpctl_dev, int bypass_mode)
>  
>  	if (!(pbpctl_dev->bp_caps & BP_PWOFF_CTL_CAP))
>  		return BP_NOT_CAP;
> -	if ((ret = cmnd_on(pbpctl_dev)) < 0)
> +	ret = cmnd_on(pbpctl_dev);
> +	if (ret < 0)
>  		return ret;
>  	if (bypass_mode)
>  		ret = bypass_state_pwroff(pbpctl_dev);
> -	else
> +	ret = cmnd_on(pbpctl_dev);
> +	if (ret < 0)
>  		ret = normal_state_pwroff(pbpctl_dev);

These added lines do not belong.  The patch will need to be redone
to fix this bug.

>  	cmnd_off(pbpctl_dev);
>  	return ret;

> @@ -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.

>  	}
>  	return set_tx(pbpctl_dev, tx_state);
>  }

regards,
dan carpenter

  parent reply	other threads:[~2013-06-17 17:24 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-17 16:26 [PATCH 1/4] silicom: checkpatch: assignments in if conditions Lorenz Haspel
2013-06-17 16:26 ` [PATCH 2/4] silicom: checkpatch: fixed whitespace errors Lorenz Haspel
2013-06-17 16:26 ` [PATCH 3/4] silicom: checkpatch: trailing statements Lorenz Haspel
2013-06-17 16:26 ` [PATCH 4/4] solicom: checkpatch: added parenthesis to macros Lorenz Haspel
2013-06-17 16:35   ` Joe Perches
2013-06-17 19:20   ` [PATCH 4/4 v2] silicom: checkpatch: errors caused by macros Lorenz Haspel
2013-06-17 19:42     ` Joe Perches
2013-06-17 20:49       ` Dan Carpenter
2013-06-17 21:03         ` Joe Perches
2013-06-17 21:14           ` Greg KH
2013-06-18  2:36             ` Joe Perches
2013-06-17 17:03 ` [PATCH 1/4] silicom: checkpatch: assignments in if conditions Dan Carpenter
     [not found]   ` <CAJ8yRxJf+B0Pgr9YWWeTbSfRZd21tF7H4j7sO-exvRXzsJYbvA@mail.gmail.com>
2013-06-17 17:25     ` Dan Carpenter
2013-06-17 17:22 ` Dan Carpenter [this message]
2013-06-17 17:34   ` Dan Carpenter
2013-06-17 17:42   ` Joe Perches
2013-06-17 19:15 ` [PATCH 1/4 v2] " Lorenz Haspel
2013-06-17 21:23   ` Dan Carpenter
2013-06-18 16:28   ` [PATCH 1/4 v3] " Lorenz Haspel
2013-06-18 18:32     ` Dan Carpenter
2013-06-18 18:32     ` Greg KH
2013-06-19  8:43       ` [PATCH 1/2 v2] silicom: checkpatch: errors caused by macros Lorenz Haspel
2013-06-19  8:44       ` [PATCH 2/2 v3] silicom: checkpatch: assignments in if conditions Lorenz Haspel
2013-06-24 23:14         ` Greg KH
2013-06-26  8:24           ` Lorenz Kernel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130617172246.GI5008@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@i4.informatik.uni-erlangen.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenz@badgers.com \
    --cc=michael.banken@mathe.stud.uni-erlangen.de \
    --cc=puff65537@bansheeslibrary.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox