The firmware running on the device sometimes survives a reboot (firmware_running returns 1). When this happens the driver never calls request_firmware, which means the kernel's firmware handling code doesn't know this firmware should be cached before hibernating. Upon resuming from several hours of hibernation, the firmware is no longer running on the device, so the driver calls request_firmware. Since the firmware was never cached, it needs to be loaded from disk, and this is when the system freezes, somewhere in the xfs driver. Fix this by always requesting the firmware, whether it's already running on the device or not.

Signed-off-by: John Smith <cantabile.d...@gmail.com>
---
--- a/drivers/net/wireless/mediatek/mt7601u/mcu.c
+++ b/drivers/net/wireless/mediatek/mt7601u/mcu.c
@@ -420,13 +420,15 @@
        mt7601u_wr(dev, MT_USB_DMA_CFG, (MT_USB_DMA_CFG_RX_BULK_EN |
                                         MT_USB_DMA_CFG_TX_BULK_EN));

-       if (firmware_running(dev))
-               return 0;
-
        ret = request_firmware(&fw, MT7601U_FIRMWARE, dev->dev);
        if (ret)
                return ret;

+       if (firmware_running(dev)) {
+               release_firmware(fw);
+               return 0;
+       }
+
        if (!fw || !fw->data || fw->size < sizeof(*hdr))
                goto err_inv_fw;

Reply via email to