linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] rsi: Slightly simplify rsi_set_channel()
@ 2023-03-20 16:13 Christophe JAILLET
  2023-03-20 19:02 ` Simon Horman
  2023-03-31 14:45 ` [net-next] wifi: " Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2023-03-20 16:13 UTC (permalink / raw)
  To: amitkarwar, siva8118, kvalo, davem, edumazet, kuba, pabeni
  Cc: linux-wireless, netdev, linux-kernel, kernel-janitors,
	Christophe JAILLET

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>
---
 drivers/net/wireless/rsi/rsi_91x_mgmt.c | 7 +++----
 1 file 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 c14689266fec..be9ac252f804 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;
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] rsi: Slightly simplify rsi_set_channel()
  2023-03-20 16:13 [PATCH net-next] rsi: Slightly simplify rsi_set_channel() Christophe JAILLET
@ 2023-03-20 19:02 ` Simon Horman
  2023-03-31 14:45 ` [net-next] wifi: " Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2023-03-20 19:02 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: amitkarwar, siva8118, kvalo, davem, edumazet, kuba, pabeni,
	linux-wireless, netdev, linux-kernel, kernel-janitors

On Mon, Mar 20, 2023 at 05:13:42PM +0100, Christophe JAILLET wrote:
> 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>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [net-next] wifi: rsi: Slightly simplify rsi_set_channel()
  2023-03-20 16:13 [PATCH net-next] rsi: Slightly simplify rsi_set_channel() Christophe JAILLET
  2023-03-20 19:02 ` Simon Horman
@ 2023-03-31 14:45 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2023-03-31 14:45 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: amitkarwar, siva8118, davem, edumazet, kuba, pabeni,
	linux-wireless, netdev, linux-kernel, kernel-janitors,
	Christophe JAILLET

Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:

> 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>

Patch applied to wireless-next.git, thanks.

8de7838acfa3 wifi: rsi: Slightly simplify rsi_set_channel()

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/29bf0296bd939e3f6952272bfdcc73b22edbc374.1679328588.git.christophe.jaillet@wanadoo.fr/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-31 14:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-20 16:13 [PATCH net-next] rsi: Slightly simplify rsi_set_channel() Christophe JAILLET
2023-03-20 19:02 ` Simon Horman
2023-03-31 14:45 ` [net-next] wifi: " Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).