Skip to content

Commit

Permalink
wilc1000: free resource in wilc_wlan_txq_add_mgmt_pkt() for failure path
Browse files Browse the repository at this point in the history
Before returing from wilc_wlan_txq_add_mgmt_pkt() invoke tx_complete_fn()
callback to free up allocated memory for failure case.

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-4-ajay.kathat@microchip.com
  • Loading branch information
Ajay Singh authored and Kalle Valo committed Dec 2, 2020
1 parent dd460e2 commit 66aea5d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/net/wireless/microchip/wilc1000/wlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,17 @@ int wilc_wlan_txq_add_mgmt_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_MGMT_PKT;
tqe->buffer = buffer;
tqe->buffer_size = buffer_size;
Expand Down

0 comments on commit 66aea5d

Please sign in to comment.