summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mediatek
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo@kernel.org>2020-03-17 17:41:17 +0100
committerFelix Fietkau <nbd@nbd.name>2020-03-17 17:47:54 +0100
commit936fca1f08ba087af3fd0ee00759374393ff2135 (patch)
tree8c646ed2159c008219a4535257d9dc608b0a0838 /drivers/net/wireless/mediatek
parentb4985ff18c829ff875bbbec92b75c656496d8f24 (diff)
mt76: mt7615: rely on skb API for mt7615_mcu_set_eeprom
Rely on skb API and avoid kmalloc the buffer in mt7615_mcu_set_eeprom routine Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7615/mcu.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
index 2ad8173f95ef..73ec31b20d21 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
@@ -1262,28 +1262,26 @@ int mt7615_mcu_set_eeprom(struct mt7615_dev *dev)
} __packed req_hdr = {
.buffer_mode = 1,
};
- int ret, len, eep_len;
- u8 *req, *eep = (u8 *)dev->mt76.eeprom.data;
+ u8 *eep = (u8 *)dev->mt76.eeprom.data;
+ struct sk_buff *skb;
+ int eep_len;
if (is_mt7622(&dev->mt76))
eep_len = MT7622_EE_MAX - MT_EE_NIC_CONF_0;
else
eep_len = MT7615_EE_MAX - MT_EE_NIC_CONF_0;
- len = sizeof(req_hdr) + eep_len;
- req = kzalloc(len, GFP_KERNEL);
- if (!req)
- return -ENOMEM;
-
req_hdr.len = cpu_to_le16(eep_len);
- memcpy(req, &req_hdr, sizeof(req_hdr));
- memcpy(req + sizeof(req_hdr), eep + MT_EE_NIC_CONF_0, eep_len);
- ret = __mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_EFUSE_BUFFER_MODE,
- req, len, true);
- kfree(req);
+ skb = mt7615_mcu_msg_alloc(NULL, sizeof(req_hdr) + eep_len);
+ if (!skb)
+ return -ENOMEM;
+
+ skb_put_data(skb, &req_hdr, sizeof(req_hdr));
+ skb_put_data(skb, eep + MT_EE_NIC_CONF_0, eep_len);
- return ret;
+ return __mt76_mcu_skb_send_msg(&dev->mt76, skb,
+ MCU_EXT_CMD_EFUSE_BUFFER_MODE, true);
}
int mt7615_mcu_set_mac_enable(struct mt7615_dev *dev, int band, bool enable)