From patchwork Thu Nov 10 11:57:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinming Hu X-Patchwork-Id: 9420981 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 BF7F5601C0 for ; Thu, 10 Nov 2016 11:58:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A973B2954D for ; Thu, 10 Nov 2016 11:58:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B93729676; Thu, 10 Nov 2016 11:58:43 +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 38F322954D for ; Thu, 10 Nov 2016 11:58:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932254AbcKJL6L (ORCPT ); Thu, 10 Nov 2016 06:58:11 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35026 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755713AbcKJL6J (ORCPT ); Thu, 10 Nov 2016 06:58:09 -0500 Received: by mail-pf0-f195.google.com with SMTP id i88so3963552pfk.2 for ; Thu, 10 Nov 2016 03:58:09 -0800 (PST) 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=waBL1SYcVa4G+aVRRadagDU+WXJDvlwItYEJzv/9rdU=; b=uNrRt4bwj6/ifXSN/yNUdDG1vOlD/h/1x/mFKP7/NO+QzuTd1Uv3gJuXUrtRtCfaws U0YTTRrKBr22Rr2hkPqsiuD2/FkWiulNRIipoHssp8oy+I5GvC1Y7NQY4uCe2fRrudl8 wjyx5i9i+uhhD7fskTeMeteDOcq+DnFIWRApSkZ3aHG585RWICw0zHdv5IqtcAOIf7Ri M8KbzPScF28vL1HPrukNwiqDBGwyerAB+8olROVX7OkYxrbFhhcojgGgUGW8Ke6DHwhJ RBZ9SKb41ezKFwOIWai26nDjYo/XrN/JDkfO8hoEhMkLYv1Xaj/xVygWkl/RO06QhDxY 61AA== 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=waBL1SYcVa4G+aVRRadagDU+WXJDvlwItYEJzv/9rdU=; b=m7/hz75obLSeTPif3mkNmBhgx6XCUb9TPQwaXJh9puhiBnKZPsCcA6Vy9+OJ1Ra6/y 2M694pcSlyDgN8/vcN49ZklNiERxj2GujFYU4Rvqp4wHivTx1xtcJgSertqLRTiCeIJT lQyURw7OBgxhfEgyDj0vfd8AKbavleu5Z3nrXoPvdziFRgYcD9SX8kSQSRfyW+1oKmzG wnx1zkqmCcntOIfFM3B1J174sWi7FumielnUmVFvuphs0dkYDcw9fgsPH4M37jWRVOZR h9nKlkOEjfw3WkXAwCIbKD9YHx14zzvze+mYL2rnM53wStRLNrdQVsh7rbF2QTjBKLZt gzjA== X-Gm-Message-State: ABUngve2gInDQggHHlrXWUZRyqJ5TBjLxt5L/JEjC2/MmahH7Ut3HcySQdiagZ2CY48aMQ== X-Received: by 10.98.84.4 with SMTP id i4mr6483193pfb.98.1478779088189; Thu, 10 Nov 2016 03:58:08 -0800 (PST) Received: from localhost.localdomain ([216.207.47.6]) by smtp.gmail.com with ESMTPSA id v10sm6740890pag.44.2016.11.10.03.58.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Nov 2016 03:58:07 -0800 (PST) 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 RESEND v2 11/11] mwifiex: pcie: stop checking for NULL adapter->card Date: Thu, 10 Nov 2016 19:57:12 +0800 Message-Id: <1478779032-5165-11-git-send-email-huxinming820@marvell.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1478779032-5165-1-git-send-email-huxinming820@marvell.com> References: <1478779032-5165-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 --- v2: Same as v1 --- 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 3b6d908..65f1f92 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -3021,31 +3021,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. @@ -3128,18 +3125,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 = {