From patchwork Wed Feb 14 11:34:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: cantabile X-Patchwork-Id: 10218475 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 91C2E6055C for ; Wed, 14 Feb 2018 11:34:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7171C28AC3 for ; Wed, 14 Feb 2018 11:34:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6488B28F35; Wed, 14 Feb 2018 11:34:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBACC28AC3 for ; Wed, 14 Feb 2018 11:34:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967396AbeBNLem (ORCPT ); Wed, 14 Feb 2018 06:34:42 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:37897 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967355AbeBNLel (ORCPT ); Wed, 14 Feb 2018 06:34:41 -0500 Received: by mail-wm0-f45.google.com with SMTP id 141so21330169wme.3 for ; Wed, 14 Feb 2018 03:34:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=Flx9FQbIuaoYVK45cKRpHb3T7cyuj6rEFcohVXJ93Go=; b=sTav4yCWKLUwgUpbhSxYaWVVWIV/kYzZJher9LuNR9+CYlkILpQ4s7zPt+G0CF6pt+ Vm4xcR3kA+NYr3OEvyWMZmKHBJH/j9qWnWY2cnGS7nj/kNZqgSJ4392LOLrqHeOVi+XG BlXz6LcJQTBRscegEOTtY/aUCRaW9yk92sWmzL0V5oeN+JY97n+NMWnigeg7DyC2rdN1 s0ZezhHvxTb6yl6We3KqQUFv4mx8cDE7v1FC+oo2G9R57SpLKdXOesOozQPwkjgE2cCk 7wLHbnuByuEBVyfEjInmu+6biftjECRoAOXKDeX2IYTByko4W1qvXpe4xkjfDQgPkLOj XoWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=Flx9FQbIuaoYVK45cKRpHb3T7cyuj6rEFcohVXJ93Go=; b=K/Xd1ZWxtRiZRByBrk6ll5/w3ZsRcTSDw+D3OxHFQF/mcsmVGuBWXns7UoytMWR8JE dsMQ8uMenSugLhQd4TPOGAHfn1FkcadaXPVshxmvM/UiG7K6NvXKuyMCghxuN0hZTY0Z zmjxyV53M/646YsSJkltoIdx0i4xnSzMX/eLb7NPvik2SFPSVgNTbejTs5NrCahSYKG2 4R37eDKr5BpNpOAZ9O9nRE6EBeXFQbGwKCIMLfGWofzXSeDmUIDRLQtY7i5/cqw/9ALG Y9Tj07QznvaPGX6/Sf9QkY4riqwvqv78ynq8TBAmIJSZHKeN469SrBJ3nizbpnfNUv+x /zRw== X-Gm-Message-State: APf1xPDlUDkPLA+vp9aRp7/XsWHLfTx7Af68kxQt4LbswhVfgHQmgRxY QslM6YXdcSn7n5KtYBOqPMQ= X-Google-Smtp-Source: AH8x224V40Jt5ltJWssvkIV10FTdSN8CkUfyW/DRXBMJMJi99PKYvOJcu4jyJOTBeoNxlbnHvNQIqA== X-Received: by 10.80.196.3 with SMTP id v3mr6512957edf.232.1518608080392; Wed, 14 Feb 2018 03:34:40 -0800 (PST) Received: from [192.168.2.50] ([89.137.22.162]) by smtp.googlemail.com with ESMTPSA id 8sm7808200edw.72.2018.02.14.03.34.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Feb 2018 03:34:39 -0800 (PST) From: cantabile Subject: [PATCH] mt7601u: Fix system freeze after resuming from hibernation To: linux-wireless@vger.kernel.org Cc: kubakici@wp.pl Message-ID: Date: Wed, 14 Feb 2018 13:34:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 Content-Language: en-GB-large Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Nacked-by: Jakub Kicinski --- 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;