From: Ajay Singh Date: Wed, 25 Nov 2020 11:41:08 +0000 (+0000) Subject: wilc1000: free resource in wilc_wlan_txq_add_net_pkt() for failure path X-Git-Tag: v5.15~2222^2~122^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd460e2ac05ffa52db52a2ab9e64f82ce402eab9;p=platform%2Fkernel%2Flinux-starfive.git wilc1000: free resource in wilc_wlan_txq_add_net_pkt() for failure path Before returing from wilc_wlan_txq_add_net_pkt() invoke tx_complete_fn() callback to free up allocated memory for failure cases. Signed-off-by: Ajay Singh Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20201125114059.10006-3-ajay.kathat@microchip.com --- diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c index 6a82fb2..f0cc2da 100644 --- a/drivers/net/wireless/microchip/wilc1000/wlan.c +++ b/drivers/net/wireless/microchip/wilc1000/wlan.c @@ -284,13 +284,17 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, wilc = vif->wilc; - if (wilc->quit) + if (wilc->quit) { + tx_complete_fn(priv, 0); return 0; + } tqe = kmalloc(sizeof(*tqe), GFP_ATOMIC); - if (!tqe) + if (!tqe) { + tx_complete_fn(priv, 0); return 0; + } tqe->type = WILC_NET_PKT; tqe->buffer = buffer; tqe->buffer_size = buffer_size;