Skip to content

Commit

Permalink
mwifiex: scan: Simplify code
Browse files Browse the repository at this point in the history
This patch:
   - improves code layout
   - removes a useless memset(0) for some memory allocated with kzalloc
   - removes a useless if. We know that 'if (chan_band_tlv)' will succeed
     because it has been tested a few lines above

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  • Loading branch information
Christophe Jaillet authored and Kalle Valo committed Sep 9, 2016
1 parent 4c5dae5 commit b711657
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions drivers/net/wireless/marvell/mwifiex/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2194,18 +2194,14 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,

if (chan_band_tlv && adapter->nd_info) {
adapter->nd_info->matches[idx] =
kzalloc(sizeof(*pmatch) +
sizeof(u32), GFP_ATOMIC);
kzalloc(sizeof(*pmatch) + sizeof(u32),
GFP_ATOMIC);

pmatch = adapter->nd_info->matches[idx];

if (pmatch) {
memset(pmatch, 0, sizeof(*pmatch));
if (chan_band_tlv) {
pmatch->n_channels = 1;
pmatch->channels[0] =
chan_band->chan_number;
}
pmatch->n_channels = 1;
pmatch->channels[0] = chan_band->chan_number;
}
}

Expand Down

0 comments on commit b711657

Please sign in to comment.