summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/microchip/wilc1000/wlan.c
diff options
context:
space:
mode:
authorAjay Singh <ajay.kathat@microchip.com>2020-11-25 14:41:08 +0300
committerKalle Valo <kvalo@codeaurora.org>2020-12-02 22:38:08 +0300
commitdd460e2ac05ffa52db52a2ab9e64f82ce402eab9 (patch)
treeac7a5c5326e79cc67709048ff5a8e6cf1fe65c50 /drivers/net/wireless/microchip/wilc1000/wlan.c
parentc04fabacb780b6d8dbc2e7258b383d7a91f69ad9 (diff)
downloadlinux-dd460e2ac05ffa52db52a2ab9e64f82ce402eab9.tar.xz
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 <ajay.kathat@microchip.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20201125114059.10006-3-ajay.kathat@microchip.com
Diffstat (limited to 'drivers/net/wireless/microchip/wilc1000/wlan.c')
-rw-r--r--drivers/net/wireless/microchip/wilc1000/wlan.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index 6a82fb2f283e..f0cc2da7c9c7 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;