From patchwork Wed Nov 2 02:24:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinming Hu X-Patchwork-Id: 9408409 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 69DF060721 for ; Wed, 2 Nov 2016 02:26:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5671529D2A for ; Wed, 2 Nov 2016 02:26:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4AC5829D2C; Wed, 2 Nov 2016 02:26:20 +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 DD52E29D2A for ; Wed, 2 Nov 2016 02:26:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755292AbcKBC0S (ORCPT ); Tue, 1 Nov 2016 22:26:18 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:33987 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755278AbcKBC0Q (ORCPT ); Tue, 1 Nov 2016 22:26:16 -0400 Received: by mail-pf0-f195.google.com with SMTP id y68so273637pfb.1 for ; Tue, 01 Nov 2016 19:26:16 -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=0EeW1Z9DmoMYrm6OpwuGMonf7j1hZ053rbGyeosN5UU=; b=zni6HekHrXcq+6/7hwYOxw7k5noe4JD0x2C0NW+PYuKkAuX1Nl5K4s659GOtiWsCT4 45eESe/3dnA95vBjc+J6Lxto5/HkzqtyZ2s+UlasJk05D5vFWyn59nZFy2QIlK2+LdoE PxtZD2GsqkWaHDMzcejZleyG6FAgqrJYNI/0JXGpiON2/cxBBKODBip92t7crUjDVmdh 08/tPf186P77pbN6+4u/rm4M5XIrI0Yms6vB8mRFSRGzOq7PIX7+cnc+7B8VhteSrf6M rp55FdFIcw+ARiyvsPv7aSFSB6TK8xAXtmkUu4Y/9bodYQ4g6oHJEcMuU8VqZLUn6T3o XImg== 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=0EeW1Z9DmoMYrm6OpwuGMonf7j1hZ053rbGyeosN5UU=; b=kVRBbvMhBFNXp10HCq+9+kDJ+zu+te63aTvezH7L43C4SObHw5JRqKRe8LRAK+QbgT jq0Pnfdk5XHqj2rNUFnzylPTcxjLktKDIDnT/8nkxjuNNzDwfc6aabePwbYoQ2mDWLkK F8MXatoTBIladPZpoeNTJeTk/6aysZCb/E9MpsJbEgI45AK3ZiXx2AAcwvsXQ3XCuV7f mMWAUCBr9fahzrOGSQso8769OSsFnYEcQk1EF7jVo3cD+Gcao4BeU4PeGmgZE6iqHmtG LkeOF7l2C2fNiZTFFGDbq2nko3O77AWccXo9bA4stGBq/Zb+O8uyH1fV5iSOOvW4Z6/R EdBw== X-Gm-Message-State: ABUngvcQrAcD7WOzwPe7Jqmn4R6U9VKlTfutahZgpUG19vxZWYQIHT8SkSVC29jf5Rxl3Q== X-Received: by 10.99.219.21 with SMTP id e21mr1966932pgg.136.1478053576162; Tue, 01 Nov 2016 19:26:16 -0700 (PDT) Received: from localhost.localdomain ([216.207.47.6]) by smtp.gmail.com with ESMTPSA id tx10sm36409076pab.40.2016.11.01.19.26.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Nov 2016 19:26:15 -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 11/12] mwifiex: stop checking for NULL drvata/intfdata Date: Wed, 2 Nov 2016 10:24:47 +0800 Message-Id: <1478053488-16042-9-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 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. --- v2: Same as v1 --- Signed-off-by: Brian Norris --- 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 04b9961..c061d00 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -102,10 +102,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, "adapter structure is not valid\n"); - return 0; - } /* Might still be loading firmware */ wait_for_completion(&card->fw_done); @@ -148,8 +144,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; } @@ -222,8 +219,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); @@ -2216,7 +2211,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 c26daf4..78b46fa 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;