diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2023-03-20 17:13:42 +0100 |
---|---|---|
committer | Kalle Valo <kvalo@kernel.org> | 2023-03-31 16:45:50 +0200 |
commit | 8de7838acfa3309fcc4c6160cb230ee79f582b18 (patch) | |
tree | f853c9a0c34c394ab4bcb6bc091c3fbf8a316d16 /drivers/net/wireless/rsi | |
parent | wifi: ipw2x00: remove unused _ipw_read16 function (diff) | |
download | linux-8de7838acfa3309fcc4c6160cb230ee79f582b18.tar.xz linux-8de7838acfa3309fcc4c6160cb230ee79f582b18.zip |
wifi: rsi: Slightly simplify rsi_set_channel()
There is no point in allocating 'skb' and then freeing it if !channel.
Make the sanity check first to slightly simplify the code.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/29bf0296bd939e3f6952272bfdcc73b22edbc374.1679328588.git.christophe.jaillet@wanadoo.fr
Diffstat (limited to 'drivers/net/wireless/rsi')
-rw-r--r-- | drivers/net/wireless/rsi/rsi_91x_mgmt.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/net/wireless/rsi/rsi_91x_mgmt.c b/drivers/net/wireless/rsi/rsi_91x_mgmt.c index 1b309e47a1f1..7f2c1608f2ce 100644 --- a/drivers/net/wireless/rsi/rsi_91x_mgmt.c +++ b/drivers/net/wireless/rsi/rsi_91x_mgmt.c @@ -1127,6 +1127,9 @@ int rsi_set_channel(struct rsi_common *common, rsi_dbg(MGMT_TX_ZONE, "%s: Sending scan req frame\n", __func__); + if (!channel) + return 0; + skb = dev_alloc_skb(frame_len); if (!skb) { rsi_dbg(ERR_ZONE, "%s: Failed in allocation of skb\n", @@ -1134,10 +1137,6 @@ int rsi_set_channel(struct rsi_common *common, return -ENOMEM; } - if (!channel) { - dev_kfree_skb(skb); - return 0; - } memset(skb->data, 0, frame_len); chan_cfg = (struct rsi_chan_config *)skb->data; |