public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs•de>
To: Dan Carpenter <error27@gmail•com>
Cc: netdev@vger•kernel.org,
	Sjur Braendeland <sjur.brandeland@stericsson•com>,
	Stephen Rothwell <sfr@canb•auug.org.au>,
	kernel-janitors@vger•kernel.org,
	"David S. Miller" <davem@davemloft•net>
Subject: Re: [patch] caif: cleanup: remove duplicate checks
Date: Sun, 23 May 2010 10:27:42 +0200	[thread overview]
Message-ID: <4BF8E6FE.9000303@bfs.de> (raw)
In-Reply-To: <20100522204519.GW22515@bicker>



Dan Carpenter schrieb:
> These checks merely duplicate the things we've asserted already.  In the
> case of the checks for null we've already dereferenced those variables
> as well.
> 
> Signed-off-by: Dan Carpenter <error27@gmail•com>
> 
> diff --git a/net/caif/cfcnfg.c b/net/caif/cfcnfg.c
> index df43f26..cc2f072 100644
> --- a/net/caif/cfcnfg.c
> +++ b/net/caif/cfcnfg.c
> @@ -313,14 +313,10 @@ cfcnfg_linkup_rsp(struct cflayer *layer, u8 channel_id, enum cfctrl_srv serv,
>  	caif_assert(phyinfo->phy_layer != NULL);
>  	caif_assert(phyinfo->phy_layer->id == phyid);
>  
> -	if (phyinfo != NULL &&
> -	    phyinfo->phy_ref_count++ == 0 &&
> -	    phyinfo->phy_layer != NULL &&
> +	if (phyinfo->phy_ref_count++ == 0 &&
>  	    phyinfo->phy_layer->modemcmd != NULL) {
> -		caif_assert(phyinfo->phy_layer->id == phyid);
>  		phyinfo->phy_layer->modemcmd(phyinfo->phy_layer,
>  					     _CAIF_MODEMCMD_PHYIF_USEFULL);
> -
>  	}
>  	adapt_layer->id = channel_id;
>  


hi Dan,
the phyinfo->phy_ref_count++  is very hidden, perhaps in terms of readability
it is better to move the phyinfo->phy_ref_count++ inside.

just my 2 cents,

re,
 wh

  reply	other threads:[~2010-05-23  8:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-22 20:45 [patch] caif: cleanup: remove duplicate checks Dan Carpenter
2010-05-23  8:27 ` walter harms [this message]
2010-05-24 16:29   ` [patch v2] " Dan Carpenter
2010-05-24 20:47     ` Sjur Brændeland
2010-05-31  7:32       ` David Miller

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=4BF8E6FE.9000303@bfs.de \
    --to=wharms@bfs$(echo .)de \
    --cc=davem@davemloft$(echo .)net \
    --cc=error27@gmail$(echo .)com \
    --cc=kernel-janitors@vger$(echo .)kernel.org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=sfr@canb$(echo .)auug.org.au \
    --cc=sjur.brandeland@stericsson$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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