Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

authored by

Christophe JAILLET and committed by
Kalle Valo
8de7838a c7e39d70

+3 -4
+3 -4
drivers/net/wireless/rsi/rsi_91x_mgmt.c
··· 1127 1127 rsi_dbg(MGMT_TX_ZONE, 1128 1128 "%s: Sending scan req frame\n", __func__); 1129 1129 1130 + if (!channel) 1131 + return 0; 1132 + 1130 1133 skb = dev_alloc_skb(frame_len); 1131 1134 if (!skb) { 1132 1135 rsi_dbg(ERR_ZONE, "%s: Failed in allocation of skb\n", ··· 1137 1134 return -ENOMEM; 1138 1135 } 1139 1136 1140 - if (!channel) { 1141 - dev_kfree_skb(skb); 1142 - return 0; 1143 - } 1144 1137 memset(skb->data, 0, frame_len); 1145 1138 chan_cfg = (struct rsi_chan_config *)skb->data; 1146 1139