From patchwork Mon Oct 31 08:02:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinming Hu X-Patchwork-Id: 9405125 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 E06226022E for ; Mon, 31 Oct 2016 08:02:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEEAA29217 for ; Mon, 31 Oct 2016 08:02:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C0AE72922F; Mon, 31 Oct 2016 08:02:54 +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 45B5F29217 for ; Mon, 31 Oct 2016 08:02:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761991AbcJaICw (ORCPT ); Mon, 31 Oct 2016 04:02:52 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:36587 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761947AbcJaICo (ORCPT ); Mon, 31 Oct 2016 04:02:44 -0400 Received: by mail-pf0-f195.google.com with SMTP id n85so8103881pfi.3 for ; Mon, 31 Oct 2016 01:02:44 -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=3pr0cJNqQOWq5Nrp+mUhQg2rxk6WSSh4yvGC2RdIAz4=; b=zb+9gnYXR65ULlk86+oZgrvVkkDajNaN3dCHDSfEsfYwUOPfwCyaR9UH8FbwP/iipd GQM6oNmoPbIUzXkx2GTAHERYtSg3+Of4H82kTwmwKWaArQzWuhCGHWdDO8hoLvvcbl5h xPEGUwS3ZxG55GPQhgBT9PktBur0oP+iNe4SHkS4/MZWVvsnaIG2Pf3Gvg6xpck4wUW+ tu+tlelLDyabfVEYKpnEEa7ktPfCLgK9ZFAmAI7qWwouXNnthhm1kzE/p1XsEYyu8xcL L7ytwem8L2B0vrZv5jK2JWfu95mKAf6aMWWQ+sFTNiZXiwu9YJ35DwlRL1R2iddJ1Ysm AmJA== 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=3pr0cJNqQOWq5Nrp+mUhQg2rxk6WSSh4yvGC2RdIAz4=; b=XdBiC2KjiLaudhPoeMMBLUtOohJQm3Qwa9cj40X+wGnz0gl++hmnOCIQ0aCyFZ2pmO SlBUk6vXfco9zxAFaWcNzHMyDKvPlYWk0WpSjm2OgknLzzl0EqA9nPYD05u2S1Z7TIsp ACZ+puTs2cDPr6GUo8IdehwhgVBODP2wjPDLZ83o282o1yvAsn/ZmKvjtyAjfV7hlfjg 0lfuxFOrymnDM1TOJl8J10hV3RyrbNdvxa0CIV603FV8bFNiRzlF/rHhZKb58E94rUvr mqMbYNNt6PKZiLmkwydra1tK5BG8bmBZ1r84LT7K28d3R46ER6GZlMhTNN//7c8GQxGY ymNg== X-Gm-Message-State: ABUngvcHVReNUDrKl/xwXjxJpA1dqjMvkadErYuNiFvucInIAqWEsilNP5Utgvao3Wvl0g== X-Received: by 10.98.31.154 with SMTP id l26mr46681307pfj.87.1477900963783; Mon, 31 Oct 2016 01:02:43 -0700 (PDT) Received: from localhost.localdomain ([216.207.47.6]) by smtp.gmail.com with ESMTPSA id k7sm34121196pan.8.2016.10.31.01.02.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 31 Oct 2016 01:02:43 -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 05/12] mwifiex: remove redundant pdev check in suspend/resume handlers Date: Mon, 31 Oct 2016 16:02:13 +0800 Message-Id: <1477900940-10549-5-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: Amitkumar Karwar to_pci_dev() would just do struct offset arithmetic on struct device to get 'pdev' pointer. We never get NULL pdev pointer. Signed-off-by: Amitkumar Karwar Signed-off-by: Brian Norris --- drivers/net/wireless/marvell/mwifiex/pcie.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index 5507c89..fb34b99 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -101,14 +101,9 @@ static int mwifiex_pcie_suspend(struct device *dev) struct pcie_service_card *card; struct pci_dev *pdev = to_pci_dev(dev); - if (pdev) { - card = pci_get_drvdata(pdev); - if (!card || !card->adapter) { - pr_err("Card or adapter structure is not valid\n"); - return 0; - } - } else { - pr_err("PCIE device is not specified\n"); + card = pci_get_drvdata(pdev); + if (!card || !card->adapter) { + pr_err("Card or adapter structure is not valid\n"); return 0; } @@ -145,14 +140,9 @@ static int mwifiex_pcie_resume(struct device *dev) struct pcie_service_card *card; struct pci_dev *pdev = to_pci_dev(dev); - if (pdev) { - card = pci_get_drvdata(pdev); - if (!card || !card->adapter) { - pr_err("Card or adapter structure is not valid\n"); - return 0; - } - } else { - pr_err("PCIE device is not specified\n"); + card = pci_get_drvdata(pdev); + if (!card || !card->adapter) { + dev_err(dev, "Card or adapter structure is not valid\n"); return 0; }