summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2020-09-30 04:01:01 +0200
committerFelix Fietkau <nbd@nbd.name>2020-12-04 13:46:14 +0100
commit96a607b643e2d81351a9de584928928d3e54f395 (patch)
treec8128aa9d6b46325073fb27d768d92636655b60e /drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c
parentf320d812b7bbd30abb5699971051e8b494df6278 (diff)
mt76: move mcu timeout handling to .mcu_parse_response
Preparation for further cleanup Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c
index e35b3a253f82..3b2184254ae9 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c
@@ -13,8 +13,18 @@
int mt76x02_mcu_parse_response(struct mt76_dev *mdev, int cmd,
struct sk_buff *skb, int seq)
{
- u32 *rxfce = (u32 *)skb->cb;
+ struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76);
+ u32 *rxfce;
+
+ if (!skb) {
+ dev_err(mdev->dev,
+ "MCU message %d (seq %d) timed out\n", cmd,
+ seq);
+ dev->mcu_timeout = 1;
+ return -ETIMEDOUT;
+ }
+ rxfce = (u32 *)skb->cb;
if (seq != FIELD_GET(MT_RX_FCE_INFO_CMD_SEQ, *rxfce))
return -EAGAIN;
@@ -57,15 +67,6 @@ int mt76x02_mcu_msg_send(struct mt76_dev *mdev, int cmd, const void *data,
while (wait_resp) {
skb = mt76_mcu_get_response(&dev->mt76, expires);
- if (!skb) {
- dev_err(mdev->dev,
- "MCU message %d (seq %d) timed out\n", cmd,
- seq);
- ret = -ETIMEDOUT;
- dev->mcu_timeout = 1;
- break;
- }
-
ret = mt76x02_mcu_parse_response(mdev, cmd, skb, seq);
dev_kfree_skb(skb);
if (ret != -EAGAIN)