From patchwork Mon Oct 31 08:02:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinming Hu X-Patchwork-Id: 9405139 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 5E21E6022E for ; Mon, 31 Oct 2016 08:03:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F5F029217 for ; Mon, 31 Oct 2016 08:03:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43F0B2922F; Mon, 31 Oct 2016 08:03:19 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 E6EEB29217 for ; Mon, 31 Oct 2016 08:03:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762011AbcJaIDQ (ORCPT ); Mon, 31 Oct 2016 04:03:16 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:33511 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761999AbcJaIDI (ORCPT ); Mon, 31 Oct 2016 04:03:08 -0400 Received: by mail-pf0-f196.google.com with SMTP id a136so4722953pfa.0 for ; Mon, 31 Oct 2016 01:03:07 -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=4ml15klqAY06LH1pzTrGduxZFFmJlZWTc8rXQY+MvXM=; b=LMaDU5e/JLCQjmzmUDJaPaB9m4gmv2QIjb3xWWA47jq5+YAttAOYMJbHPwzR6uqNJk iXbMyvpBRw16i45TWwirh1TWDds4xicHI6hfDymNv1B0+X11XJFg/ywxn0Ea+P8hxfVV n5uGVf5WfualjHuAnBko6X1JBRXJ1bGkUcOCm/Gfom3w1aWztqse59HONSQJLMDUU4Qz G4RGq1HKRrvk6+xmoCG/WSoZtI6YTTyldc+h+eu2C4uKEhHeX9DCAJk1hdleX9XxCipr lESGDb0x1D97cygcUgylznfeGeTeTCs0TZY72eeVfN4XNjfE0wE7VuNiQlK2lHMYUszV 6MDw== 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=4ml15klqAY06LH1pzTrGduxZFFmJlZWTc8rXQY+MvXM=; b=Cce2rldtlDea/SY3J8Y4aQPRtYQgEmVbilOORAW9RzTjHwxReN4TIEhLE2atzwG3iB 7YwxPo9mOqKwSvo22N9YiYBI9JfmcBw2owMBQ67Dajn5SnWPL5XyvoBq/y1l8vapL5LK s6AEQUqd+c4kMBR9b5cB9CC5dMAFuGZGkEGf4RCtP+fGRvIp8k2YF8DBWHDv+yvgdWjW wtA/6arfxI5pOEUYZlHsnoqoLffF3+MGQSivWFmp6s272P1lPJ/sdTTyjFhDXljBGSTa iCh8s3FJoplcXHHDGp9I35jhgasMqLjghs3haCSuch5MzmJRt67YnASazV1Vrwex6sZ0 iKjA== X-Gm-Message-State: ABUngveBkpezoaDzj/lk0b++nHuVO+Rk2Lms6N0PlPAMKASpI0wI6k6DFRfdgUIR7nPPHw== X-Received: by 10.98.11.71 with SMTP id t68mr6593153pfi.136.1477900987235; Mon, 31 Oct 2016 01:03:07 -0700 (PDT) Received: from localhost.localdomain ([216.207.47.6]) by smtp.gmail.com with ESMTPSA id k7sm34121196pan.8.2016.10.31.01.03.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 31 Oct 2016 01:03:06 -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 12/12] mwifiex: pcie: stop checking for NULL adapter->card Date: Mon, 31 Oct 2016 16:02:20 +0800 Message-Id: <1477900940-10549-12-git-send-email-huxinming820@marvell.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1477900940-10549-1-git-send-email-huxinming820@marvell.com> References: <1477900940-10549-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. 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 = {