Commit dd460e2a authored by Ajay Singh's avatar Ajay Singh Committed by Kalle Valo
Browse files

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: default avatarAjay Singh <ajay.kathat@microchip.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201125114059.10006-3-ajay.kathat@microchip.com
parent c04fabac
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -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;