mt76: mt7915: fix potential memory leak in mcu message handler

Fix potential memory leak in mcu message handler on error condition.

Fixes: c6b002bcdfa6 ("mt76: add mac80211 driver for MT7915 PCIe-based chipsets")
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Ryder Lee 2020-07-12 01:25:51 +08:00 committed by Felix Fietkau
parent 1f8284150d
commit 4c7e1711cf

View File

@ -312,8 +312,10 @@ mt7915_mcu_parse_response(struct mt7915_dev *dev, int cmd,
struct mt7915_mcu_rxd *rxd = (struct mt7915_mcu_rxd *)skb->data; struct mt7915_mcu_rxd *rxd = (struct mt7915_mcu_rxd *)skb->data;
int ret = 0; int ret = 0;
if (seq != rxd->seq) if (seq != rxd->seq) {
return -EAGAIN; ret = -EAGAIN;
goto out;
}
switch (cmd) { switch (cmd) {
case -MCU_CMD_PATCH_SEM_CONTROL: case -MCU_CMD_PATCH_SEM_CONTROL:
@ -330,6 +332,7 @@ mt7915_mcu_parse_response(struct mt7915_dev *dev, int cmd,
default: default:
break; break;
} }
out:
dev_kfree_skb(skb); dev_kfree_skb(skb);
return ret; return ret;