From patchwork Thu Nov 10 11:57:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinming Hu X-Patchwork-Id: 9420979 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 4631E601C0 for ; Thu, 10 Nov 2016 11:58:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 325582954D for ; Thu, 10 Nov 2016 11:58:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2733929676; Thu, 10 Nov 2016 11:58:29 +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 B656F2954D for ; Thu, 10 Nov 2016 11:58:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932434AbcKJL6M (ORCPT ); Thu, 10 Nov 2016 06:58:12 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:32971 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754303AbcKJL6G (ORCPT ); Thu, 10 Nov 2016 06:58:06 -0500 Received: by mail-pf0-f196.google.com with SMTP id 144so3986676pfv.0 for ; Thu, 10 Nov 2016 03:58:05 -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=wstXtUy0Phzmu2Y5hOjs3hn3Jd936YQc7NKSDKrqTo0=; b=rfoEXX6V2m1EPTbxKGuUEDW45R+wzX18ZrGSLVtg3esBkIK1SX2c9TwN6s8Fz2dhZS Cgi4g57Adl9YSrT/csbu+KBh1WXYrB6o0Rz2xYAGga0/6qCp6hfa51JV73dkw/1l9FI/ RuJ57G6//vmFjLzihrXdQ/4Mm0JxL+NWBUHVkUhhcjFgNxBMx/xXAHaM+UPP7L1jDd1r pCZ0i2nLM6L6euizULXbWhpx11LGwLflRCFScJ71Ay5f1UlFSMyLpskfLbdYqAWVAdgI yi2Bxch4UpOY0onzeNAuNj2cfVzGvOnd+q5UK1vccWdLNDKIkbggRtDzYLoQBmMKA+bl hmrA== 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=wstXtUy0Phzmu2Y5hOjs3hn3Jd936YQc7NKSDKrqTo0=; b=XOPnTJrMul57Gn3pHLW3uzloHNBRQ28iwbqoTAyxM/TmuBX79Tt5Se2rRxvoAM4spS qoMuxCi+nkHQE/Bms9SiSKVMjM+VB0PESWBTxEImTdD9erXA7d/UJQqWVbV5BRzMEp3P 722MjD5mH3oX2D+zOzVv33+6Z5SVVURTEgIuLfD/4RkoEDJjoInWRgu2t0qzi0QtD3G2 9+1X9/x2Q1961sK7xqEQyoON1mq4Cmnq8z1Delx9ptWVdi3pHR14hvtn+xKIuW4XYeU3 AYXzhR1TPQva5rxqclrpRaVB+VgQ0GH9eO2lNf2Uxfs8XxBEilcBBTs6XTxkbyrklySM ++Iw== X-Gm-Message-State: ABUngvcdMXNJ4+cZacEda9uLpm1gakN/NcfyJ6Zfq6WI4Z4a8tWmK6+9xJu1sfCP5+O7gQ== X-Received: by 10.98.158.155 with SMTP id f27mr9336356pfk.165.1478779085348; Thu, 10 Nov 2016 03:58:05 -0800 (PST) Received: from localhost.localdomain ([216.207.47.6]) by smtp.gmail.com with ESMTPSA id v10sm6740890pag.44.2016.11.10.03.58.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Nov 2016 03:58:05 -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 10/11] mwifiex: stop checking for NULL drvata/intfdata Date: Thu, 10 Nov 2016 19:57:11 +0800 Message-Id: <1478779032-5165-10-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 These are never NULL, so stop making people think they might be. I don't change this for SDIO because SDIO has a racy card-reset handler that reallocates this struct. I'd rather not touch that mess right now. Signed-off-by: Brian Norris --- v2: Same as v1 --- drivers/net/wireless/marvell/mwifiex/pcie.c | 14 +++++--------- drivers/net/wireless/marvell/mwifiex/usb.c | 15 +++------------ 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index 1ab366c..3b6d908 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -118,10 +118,6 @@ static int mwifiex_pcie_suspend(struct device *dev) struct pci_dev *pdev = to_pci_dev(dev); card = pci_get_drvdata(pdev); - if (!card) { - dev_err(dev, "card structure is not valid\n"); - return 0; - } /* Might still be loading firmware */ wait_for_completion(&card->fw_done); @@ -166,8 +162,9 @@ static int mwifiex_pcie_resume(struct device *dev) struct pci_dev *pdev = to_pci_dev(dev); card = pci_get_drvdata(pdev); - if (!card || !card->adapter) { - dev_err(dev, "Card or adapter structure is not valid\n"); + + if (!card->adapter) { + dev_err(dev, "adapter structure is not valid\n"); return 0; } @@ -255,8 +252,6 @@ static void mwifiex_pcie_remove(struct pci_dev *pdev) struct mwifiex_private *priv; card = pci_get_drvdata(pdev); - if (!card) - return; wait_for_completion(&card->fw_done); @@ -2249,7 +2244,8 @@ static irqreturn_t mwifiex_pcie_interrupt(int irq, void *context) } card = pci_get_drvdata(pdev); - if (!card || !card->adapter) { + + if (!card->adapter) { pr_err("info: %s: card=%p adapter=%p\n", __func__, card, card ? card->adapter : NULL); goto exit; diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c index 8bcfd92..806ded6 100644 --- a/drivers/net/wireless/marvell/mwifiex/usb.c +++ b/drivers/net/wireless/marvell/mwifiex/usb.c @@ -503,11 +503,6 @@ static int mwifiex_usb_suspend(struct usb_interface *intf, pm_message_t message) struct usb_tx_data_port *port; int i, j; - if (!card) { - dev_err(&intf->dev, "%s: card is NULL\n", __func__); - return 0; - } - /* Might still be loading firmware */ wait_for_completion(&card->fw_done); @@ -574,8 +569,9 @@ static int mwifiex_usb_resume(struct usb_interface *intf) struct mwifiex_adapter *adapter; int i; - if (!card || !card->adapter) { - pr_err("%s: card or card->adapter is NULL\n", __func__); + if (!card->adapter) { + dev_err(&intf->dev, "%s: card->adapter is NULL\n", + __func__); return 0; } adapter = card->adapter; @@ -617,11 +613,6 @@ static void mwifiex_usb_disconnect(struct usb_interface *intf) struct usb_card_rec *card = usb_get_intfdata(intf); struct mwifiex_adapter *adapter; - if (!card) { - dev_err(&intf->dev, "%s: card is NULL\n", __func__); - return; - } - wait_for_completion(&card->fw_done); adapter = card->adapter;