Search Linux Wireless

[PATCH 4/6] qtnfmac: fix rmmod for missing firmware

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Check that firmware exists prior to starting firmware download.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@xxxxxxxxxxxxx>
---
 drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c
index c0d1c5d94ef0..86368e345276 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c
@@ -1104,6 +1104,20 @@ static void qtnf_firmware_load(const struct firmware *fw, void *context)
 	complete(&bus->request_firmware_complete);
 }
 
+static int qtnf_fw_exists(struct qtnf_bus *bus)
+{
+	struct qtnf_pcie_bus_priv *priv = (void *)get_bus_priv(bus);
+	struct pci_dev *pdev = priv->pdev;
+	const struct firmware *fw;
+	int ret;
+
+	ret = request_firmware(&fw, bus->fwname, &pdev->dev);
+	if (!ret)
+		release_firmware(fw);
+
+	return !ret;
+}
+
 static int qtnf_bringup_fw(struct qtnf_bus *bus)
 {
 	struct qtnf_pcie_bus_priv *priv = (void *)get_bus_priv(bus);
@@ -1358,6 +1372,12 @@ static int qtnf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	netif_napi_add(&bus->mux_dev, &bus->mux_napi,
 		       qtnf_rx_poll, 10);
 
+	if (!flashboot && !qtnf_fw_exists(bus)) {
+		pr_err("failed to get firmware %s\n", bus->fwname);
+		ret = -ENOENT;
+		goto err_fw;
+	}
+
 	ret = qtnf_bringup_fw(bus);
 	if (ret < 0)
 		goto err_fw;
-- 
2.11.0




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux