Return-path: Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:40723 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754595AbcJFRbQ (ORCPT ); Thu, 6 Oct 2016 13:31:16 -0400 From: Amitkumar Karwar To: CC: Cathy Luo , Nishant Sarmukadam , , , Amitkumar Karwar Subject: [PATCH v3 2/3] mwifiex: remove redundant pdev check in suspend/resume handlers Date: Thu, 6 Oct 2016 23:00:27 +0530 Message-ID: <1475775028-20306-2-git-send-email-akarwar@marvell.com> (sfid-20161006_193120_950446_52CB557D) In-Reply-To: <1475775028-20306-1-git-send-email-akarwar@marvell.com> References: <1475775028-20306-1-git-send-email-akarwar@marvell.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-wireless-owner@vger.kernel.org List-ID: 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 --- New patch prepared as per inputs from Brian Norris. It wasn't part of v1 and v2 series --- 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 ba9e068..1e27dbf 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -120,14 +120,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; } @@ -164,14 +159,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) { + pr_err("Card or adapter structure is not valid\n"); return 0; } -- 1.9.1