Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1473373
| From | Christophe JAILLET <christophe.jaillet@wanadoo.fr> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] mwifiex: scan: Simplify code |
| Date | 2016-08-31 14:00 +0200 |
| Message-ID | <scclr-1X7-15@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
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>
---
drivers/net/wireless/marvell/mwifiex/scan.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c b/drivers/net/wireless/marvell/mwifiex/scan.c
index 21ec84794d0c..c29dd958acae 100644
--- a/drivers/net/wireless/marvell/mwifiex/scan.c
+++ b/drivers/net/wireless/marvell/mwifiex/scan.c
@@ -2179,18 +2179,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;
}
}
--
2.7.4
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] mwifiex: scan: Simplify code Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2016-08-31 14:00 +0200 Re: [PATCH] mwifiex: scan: Simplify code Joe Perches <joe@perches.com> - 2016-08-31 17:10 +0200 Re: mwifiex: scan: Simplify code Kalle Valo <kvalo@codeaurora.org> - 2016-09-09 11:30 +0200
csiph-web