Commit 8de7838a authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Kalle Valo

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: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/29bf0296bd939e3f6952272bfdcc73b22edbc374.1679328588.git.christophe.jaillet@wanadoo.fr
parent c7e39d70
......@@ -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;
......
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