From patchwork Thu Nov 10 11:57:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinming Hu X-Patchwork-Id: 9420963 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 538E2601C0 for ; Thu, 10 Nov 2016 11:57:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 403E02954D for ; Thu, 10 Nov 2016 11:57:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3452229676; Thu, 10 Nov 2016 11:57:52 +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 C93492954D for ; Thu, 10 Nov 2016 11:57:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755647AbcKJL5t (ORCPT ); Thu, 10 Nov 2016 06:57:49 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:32853 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755507AbcKJL5s (ORCPT ); Thu, 10 Nov 2016 06:57:48 -0500 Received: by mail-pf0-f196.google.com with SMTP id 144so3985854pfv.0 for ; Thu, 10 Nov 2016 03:57:48 -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=0kCSYslMNmSFxNO8Kzw+YxFP+BLwHHTYxUAlrWWBK0g=; b=Y9yuP+x7ElpM7+xCS2A+AOKxLlcGVwHG4X4hoM2EKrOp8LBl3+IyQpQLF8D//PX2L4 vNIz32IKJ57riav6dI05hCX4AgU44SudY5NWTAq2gajOJzZ7EDiW1yc+CJ6Fs1stFc08 dC13hwfmJYKgy29aDYmyj64Zv/r0y1Lat7p7KycPtTyACOgGkleI4v/jCzhqo82VenkU yAniclw109kTE4wbcWh2RRjjBD2XSgbe5jV0MA9IOPH5ZXG+XMLrH3IXjefDcIS66HLc ceGx2A3NebJoIyicmR8ooDsCO8pU08XjHA7olUPUiRdu1yVYNZhs0GklAmTXw3TzZL/C a6eQ== 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=0kCSYslMNmSFxNO8Kzw+YxFP+BLwHHTYxUAlrWWBK0g=; b=h7h/dN+UqMcJ1SIAJDLrLQL6E4OksrYBhyq/YHXaAb0xZLIn6S9urnBLLr79sWa8uJ LBP32nqb6zsD+wvqAYCwA9jy41pODZBb+KDMNaU1WNL7WkzCDmc4u+SSfkj4AK+zH36W TejD4Ke28zky7h6AhF+bL71xFm45AbEMZBtwxhxBfX8EY/S4bSeNnicZHuvVIE7Ie/Zh +Z9rzAk+Us/hl2TuKxvOWvKM+smu+ORxmyEcv5Dt5/8dsWzitSLAFBzje2ZHEHUjyPT5 pM2Xrqjc0JHi3p6mlUTAYSbGj/vH869ueNgONllbYa7LUwE6mD8YRUwqXljapH/03lKS 5/7w== X-Gm-Message-State: ABUngvfOhhX/0BsVWqtyTPyIuGcW9793zdUDq6HhxvDLp0Yp3Jr4JYpAG7XlE9KOQcSRgg== X-Received: by 10.99.126.6 with SMTP id z6mr35211927pgc.182.1478779067816; Thu, 10 Nov 2016 03:57:47 -0800 (PST) Received: from localhost.localdomain ([216.207.47.6]) by smtp.gmail.com with ESMTPSA id v10sm6740890pag.44.2016.11.10.03.57.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Nov 2016 03:57:47 -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 04/11] mwifiex: remove redundant pdev check in suspend/resume handlers Date: Thu, 10 Nov 2016 19:57:05 +0800 Message-Id: <1478779032-5165-4-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: 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 --- v2: Same as v1 --- 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 c4bd64b..6152f08 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -117,14 +117,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; } @@ -162,14 +157,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; }