Commit 9bfca3c6 authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

caif: cleanup: remove duplicate checks

"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: default avatarDan Carpenter <error27@gmail.com>
Acked-by: default avatarSjur Braendeland <sjur.brandeland@stericsson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f5d72af9
...@@ -308,19 +308,15 @@ cfcnfg_linkup_rsp(struct cflayer *layer, u8 channel_id, enum cfctrl_srv serv, ...@@ -308,19 +308,15 @@ cfcnfg_linkup_rsp(struct cflayer *layer, u8 channel_id, enum cfctrl_srv serv,
caif_assert(cnfg != NULL); caif_assert(cnfg != NULL);
caif_assert(phyid != 0); caif_assert(phyid != 0);
phyinfo = &cnfg->phy_layers[phyid]; phyinfo = &cnfg->phy_layers[phyid];
caif_assert(phyinfo != NULL);
caif_assert(phyinfo->id == phyid); caif_assert(phyinfo->id == phyid);
caif_assert(phyinfo->phy_layer != NULL); caif_assert(phyinfo->phy_layer != NULL);
caif_assert(phyinfo->phy_layer->id == phyid); caif_assert(phyinfo->phy_layer->id == phyid);
if (phyinfo != NULL && phyinfo->phy_ref_count++;
phyinfo->phy_ref_count++ == 0 && if (phyinfo->phy_ref_count == 1 &&
phyinfo->phy_layer != NULL &&
phyinfo->phy_layer->modemcmd != NULL) { phyinfo->phy_layer->modemcmd != NULL) {
caif_assert(phyinfo->phy_layer->id == phyid);
phyinfo->phy_layer->modemcmd(phyinfo->phy_layer, phyinfo->phy_layer->modemcmd(phyinfo->phy_layer,
_CAIF_MODEMCMD_PHYIF_USEFULL); _CAIF_MODEMCMD_PHYIF_USEFULL);
} }
adapt_layer->id = channel_id; adapt_layer->id = channel_id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment