From patchwork Wed Nov 2 02:24:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinming Hu X-Patchwork-Id: 9408411 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 B9ACF60721 for ; Wed, 2 Nov 2016 02:26:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A68C829D2A for ; Wed, 2 Nov 2016 02:26:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B7EB29D2C; Wed, 2 Nov 2016 02:26:24 +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 CA6B529D2A for ; Wed, 2 Nov 2016 02:26:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755296AbcKBC0W (ORCPT ); Tue, 1 Nov 2016 22:26:22 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:35622 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755278AbcKBC0V (ORCPT ); Tue, 1 Nov 2016 22:26:21 -0400 Received: by mail-pf0-f196.google.com with SMTP id i88so270613pfk.2 for ; Tue, 01 Nov 2016 19:26:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xCmVgHzCzxvIaM4cEl+IyzqA1TZnlwN7l3RMCeNrTTk=; b=Zx6jtg5tq/4pyaO0f/LucFsFq3hori6nDs3k0JuYMpAyrlCLff3XFySVfJPPmQ+IUO 5fsm0GVhBngsqApq9OoWytfvMJepVkYigDF+udY/tZDlrQgjuRxIuDn8GcgZWXvOU86r 5r2FDtBRWUrIkqiMtpDZsZ3mir+vEDkZ9EjOCimDaZjZ6qUKQ+Agqf9zd3RrcmT28m6f rvvMLs2WJZ972P37Vun34JcDuTlxMTRmGwNA8hAGMuJsG7i3QQcRMIuB+0ORQWPfjKO7 3kF0q8n2cPzQ1uv/uSGw7OMLRZWKITuyhIbDEEspLGhDfvqoOw03JwKBI25+hQ07v6mz 23lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xCmVgHzCzxvIaM4cEl+IyzqA1TZnlwN7l3RMCeNrTTk=; b=Idnc32MEvBkARAB/TGDw7Z7BpW/AGVmh39JVYp/y2i2Gzn+obYCqLOshhZcOTXs1HL D/LA6kAeichfKGYLeOqjJ6UR3pfKkN0lJvgrKYn8b45BIWtQ765uhyFCOhICqnggaUSO a4Z97pLPdy/+Ntyi1ShiOW/2X4YTmXlqpHySHJKfjIg3Lx2ZptzZOmmTGgSqx8U8lfmr rrnPtvoZX2FrOSfsxWhRH63NPU096Fik/OAyScWWboAvUxfVKUMqkYf6PN8+iMXXBxXc wUy7GK+f5/k+ArzjdZRYrmkc4NZW9wggG4IUKxBICVHGcLva0vHYALtFu7YtDu0ORUK9 1vfA== X-Gm-Message-State: ABUngvcn6bnoGKHOlPCJMR7jy6uHnBKk8ehoJV+Vcpv0b1WhYR2rlx9Zv3mH/leNiayYbA== X-Received: by 10.98.14.82 with SMTP id w79mr2240317pfi.153.1478053580639; Tue, 01 Nov 2016 19:26:20 -0700 (PDT) Received: from localhost.localdomain ([216.207.47.6]) by smtp.gmail.com with ESMTPSA id tx10sm36409076pab.40.2016.11.01.19.26.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Nov 2016 19:26:20 -0700 (PDT) From: Xinming Hu X-Google-Original-From: Xinming Hu To: Linux Wireless Cc: Kalle Valo , Brian Norris , Dmitry Torokhov , Amitkumar Karwar , Cathy Luo , Brian Norris Subject: [PATCH v2 12/12] mwifiex: pcie: stop checking for NULL adapter->card Date: Wed, 2 Nov 2016 10:24:48 +0800 Message-Id: <1478053488-16042-10-git-send-email-huxinming820@marvell.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1478053488-16042-1-git-send-email-huxinming820@marvell.com> References: <1478053488-16042-1-git-send-email-huxinming820@marvell.com> 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 From: Brian Norris It should never be NULL here, and to think otherwise makes things confusing. --- v2: Same as v1 --- Signed-off-by: Brian Norris --- drivers/net/wireless/marvell/mwifiex/pcie.c | 55 +++++++++++++---------------- 1 file changed, 24 insertions(+), 31 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index c061d00..86e8ce6 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -2990,31 +2990,28 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter) static void mwifiex_unregister_dev(struct mwifiex_adapter *adapter) { struct pcie_service_card *card = adapter->card; - struct pci_dev *pdev; + struct pci_dev *pdev = card->dev; int i; - if (card) { - pdev = card->dev; - if (card->msix_enable) { - for (i = 0; i < MWIFIEX_NUM_MSIX_VECTORS; i++) - synchronize_irq(card->msix_entries[i].vector); + if (card->msix_enable) { + for (i = 0; i < MWIFIEX_NUM_MSIX_VECTORS; i++) + synchronize_irq(card->msix_entries[i].vector); - for (i = 0; i < MWIFIEX_NUM_MSIX_VECTORS; i++) - free_irq(card->msix_entries[i].vector, - &card->msix_ctx[i]); + for (i = 0; i < MWIFIEX_NUM_MSIX_VECTORS; i++) + free_irq(card->msix_entries[i].vector, + &card->msix_ctx[i]); - card->msix_enable = 0; - pci_disable_msix(pdev); - } else { - mwifiex_dbg(adapter, INFO, - "%s(): calling free_irq()\n", __func__); - free_irq(card->dev->irq, &card->share_irq_ctx); + card->msix_enable = 0; + pci_disable_msix(pdev); + } else { + mwifiex_dbg(adapter, INFO, + "%s(): calling free_irq()\n", __func__); + free_irq(card->dev->irq, &card->share_irq_ctx); - if (card->msi_enable) - pci_disable_msi(pdev); - } - card->adapter = NULL; - } + if (card->msi_enable) + pci_disable_msi(pdev); + } + card->adapter = NULL; } /* This function initializes the PCI-E host memory space, WCB rings, etc. @@ -3097,18 +3094,14 @@ static void mwifiex_pcie_down_dev(struct mwifiex_adapter *adapter) adapter->seq_num = 0; adapter->tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K; - if (card) { - if (reg->sleep_cookie) - mwifiex_pcie_delete_sleep_cookie_buf(adapter); - - mwifiex_pcie_delete_cmdrsp_buf(adapter); - mwifiex_pcie_delete_evtbd_ring(adapter); - mwifiex_pcie_delete_rxbd_ring(adapter); - mwifiex_pcie_delete_txbd_ring(adapter); - card->cmdrsp_buf = NULL; - } + if (reg->sleep_cookie) + mwifiex_pcie_delete_sleep_cookie_buf(adapter); - return; + mwifiex_pcie_delete_cmdrsp_buf(adapter); + mwifiex_pcie_delete_evtbd_ring(adapter); + mwifiex_pcie_delete_rxbd_ring(adapter); + mwifiex_pcie_delete_txbd_ring(adapter); + card->cmdrsp_buf = NULL; } static struct mwifiex_if_ops pcie_ops = {