From patchwork Mon Jul 31 16:10:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Joachim X-Patchwork-Id: 9872413 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 A27D960375 for ; Mon, 31 Jul 2017 16:11:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95885283C5 for ; Mon, 31 Jul 2017 16:11:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A6FA283F5; Mon, 31 Jul 2017 16:11:12 +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=-6.9 required=2.0 tests=BAYES_00,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 0D7B5283C5 for ; Mon, 31 Jul 2017 16:11:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752429AbdGaQLK (ORCPT ); Mon, 31 Jul 2017 12:11:10 -0400 Received: from mout.gmx.net ([212.227.17.22]:59475 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751046AbdGaQLI (ORCPT ); Mon, 31 Jul 2017 12:11:08 -0400 Received: from localhost.localdomain ([91.19.62.57]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MSY2q-1dAg170t2C-00RYEK; Mon, 31 Jul 2017 18:10:49 +0200 Received: by localhost.localdomain (Postfix, from userid 1000) id 85C3A80070; Mon, 31 Jul 2017 18:10:45 +0200 (CEST) From: Sven Joachim To: Larry Finger Cc: linux-wireless@vger.kernel.org, Ping-Ke Shih , Kalle Valo Subject: [PATCH v2] rtlwifi: Fix fallback firmware loading References: <87k22sq0de.fsf@turtle.gmx.de> <87a83noaxw.fsf@turtle.gmx.de> Date: Mon, 31 Jul 2017 18:10:45 +0200 In-Reply-To: (Larry Finger's message of "Sun, 30 Jul 2017 18:57:57 -0500") Message-ID: <87d18gmvsq.fsf_-_@turtle.gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 X-Provags-ID: V03:K0:xfM4YKG2BWK2RisN3hIGIFEyREIjL69yu7brLZSh1g6xG/eOuXr q1hEjszAP/4itrBaw5XEWsqVcq0b8qN66nR7R63z9lOJ8+pSdD7zTIE1/wr5H7LsUV7rXrT rwyyvcbm6ASfh8+84Pj0WJaorP1Ya3uGcET+EXdaPE0josMMNQtpiWVZRDdotvxm69RPUhp 7QzUCzo3qniges5xRTEWQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:QgA9JwdiOu0=:OFcV88DZzRZvihMWMItNvM NRH1ufB6f+HAVf2X4RErXcoF2Ja3RZfmJRkKzAqyvR9n4fyDNMm9+1a3L6PDUCsSZz0MMHhOR p+DiCWAYUJ93/Zg9WjEm/uAf9al/wPSFh0ghU4zc5RqT13+I6aGk4isldc3QrnnkUHBC3KTef iiIYi3rpot/hOvj8sENXcCffkbFPiHVgbqf4BPJRb69EgWkpT27B2jUKHsq6Z9y5apb0sp7ap hFE5JGyW5C0mSX3YqXobx1BZfoN+K4eoeLVzvX30hgMgaLJLASossQIoS6WdtNmpcr9FS4IOI HOqlnmrwdOgzJK14Cz0/OchtyO98KTH4NALUokjV5QYCBdnZVhyd+0AZVYIn6uMhd3HayCL9g u4PV09fbHUWVcMBtzj1WbI1FlFUgpmFDHXEjFC1Yt3FqqjQbVnXVaapLOz4/+/PXaoefmpVXX xztP2kaIjl6fVizH4cAhAJisFctgUz3ANIGzYFv9nB2OUn/EJSXXPlepRuzzJ6Mx8VFFl8vmy 8ORQtzz8URefSwggPHyQw1fJs9gFBafeeBd2eIgsrU9F+CWfV/NzV/6DhK4pPYZIuAdzQj75j cI/kZh8AL/zM/t+wBYdLnp5hz9DjWo4+1ciDsU7+Pm8oQQXBkkqNuwLiiDN59pcZncwrukOh5 mWi8x033Qsf66e630uKL6aaR9PP3t+ovbxqLEZ3d7YxfLyV6vPNYCTcye/tftFhWv45o5nmzu Y/4LsUSzxNjcfb+ZIZk8ZNJe4CLSkiGksFBYI9Txc/TJr0ENVzDmycXcFk0B8iQsNrWy1JrQn aJhe6l3mfeDTZkpDK2IqLXjQbBqJP9ygyihHKjdi4DUcPNtjVI= 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 Commit f70e4df2b384 ("rtlwifi: Add code to read new versions of firmware") added code to load an old firmware file if the new one is not available. Unfortunately that code is never reached because request_firmware_nowait() does not wait for the firmware to show up and returns 0 even if the file is not there. Use the existing fallback mechanism introduced by commit 62009b7f1279 ("rtlwifi: rtl8192cu: Add new firmware") instead. Fixes: f70e4df2b384 ("rtlwifi: Add code to read new versions of firmware") Cc: stable@vger.kernel.org Signed-off-by: Sven Joachim --- drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c | 17 +++++------------ drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c | 17 +++++------------ 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c index 56c05c4e1499..f47d839f388d 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c @@ -187,18 +187,10 @@ int rtl8723be_init_sw_vars(struct ieee80211_hw *hw) rtlpriv->io.dev, GFP_KERNEL, hw, rtl_fw_cb); if (err) { - /* Failed to get firmware. Check if old version available */ - fw_name = "rtlwifi/rtl8723befw.bin"; - pr_info("Using firmware %s\n", fw_name); - err = request_firmware_nowait(THIS_MODULE, 1, fw_name, - rtlpriv->io.dev, GFP_KERNEL, hw, - rtl_fw_cb); - if (err) { - pr_err("Failed to request firmware!\n"); - vfree(rtlpriv->rtlhal.pfirmware); - rtlpriv->rtlhal.pfirmware = NULL; - return 1; - } + pr_err("Failed to request firmware!\n"); + vfree(rtlpriv->rtlhal.pfirmware); + rtlpriv->rtlhal.pfirmware = NULL; + return 1; } return 0; } @@ -289,6 +281,7 @@ static const struct rtl_hal_cfg rtl8723be_hal_cfg = { .bar_id = 2, .write_readback = true, .name = "rtl8723be_pci", + .alt_fw_name = "rtlwifi/rtl8723befw.bin", .ops = &rtl8723be_hal_ops, .mod_params = &rtl8723be_mod_params, .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL, diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c index ec2d577ba85b..5925edf7877f 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c @@ -216,18 +216,10 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw) rtlpriv->io.dev, GFP_KERNEL, hw, rtl_fw_cb); if (err) { - /* Failed to get firmware. Check if old version available */ - fw_name = "rtlwifi/rtl8821aefw.bin"; - pr_info("Using firmware %s\n", fw_name); - err = request_firmware_nowait(THIS_MODULE, 1, fw_name, - rtlpriv->io.dev, GFP_KERNEL, hw, - rtl_fw_cb); - if (err) { - pr_err("Failed to request normal firmware!\n"); - vfree(rtlpriv->rtlhal.wowlan_firmware); - vfree(rtlpriv->rtlhal.pfirmware); - return 1; - } + pr_err("Failed to request normal firmware!\n"); + vfree(rtlpriv->rtlhal.wowlan_firmware); + vfree(rtlpriv->rtlhal.pfirmware); + return 1; } /*load wowlan firmware*/ pr_info("Using firmware %s\n", wowlan_fw_name); @@ -331,6 +323,7 @@ static const struct rtl_hal_cfg rtl8821ae_hal_cfg = { .bar_id = 2, .write_readback = true, .name = "rtl8821ae_pci", + .alt_fw_name = "rtlwifi/rtl8821aefw.bin", .ops = &rtl8821ae_hal_ops, .mod_params = &rtl8821ae_mod_params, .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL,