Skip to content

Commit

Permalink
caif: cleanup: remove duplicate checks
Browse files Browse the repository at this point in the history
"phyinfo" can never be null here because we assigned it an address, so I
removed both the assert and the second check inside the if statement.  I
removed the "phyinfo->phy_layer != NULL" check as well because that was
asserted earlier.

Walter Harms suggested I move the "phyinfo->phy_ref_count++;" outside
the if condition for readability, so I have done that.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Sjur Braendeland <sjur.brandeland@stericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed May 31, 2010
1 parent f5d72af commit 9bfca3c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions net/caif/cfcnfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,19 +308,15 @@ cfcnfg_linkup_rsp(struct cflayer *layer, u8 channel_id, enum cfctrl_srv serv,
caif_assert(cnfg != NULL);
caif_assert(phyid != 0);
phyinfo = &cnfg->phy_layers[phyid];
caif_assert(phyinfo != NULL);
caif_assert(phyinfo->id == phyid);
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 &&
phyinfo->phy_ref_count++;
if (phyinfo->phy_ref_count == 1 &&
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;

Expand Down

0 comments on commit 9bfca3c

Please sign in to comment.