From patchwork Mon Oct 31 08:02:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinming Hu X-Patchwork-Id: 9405135 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 28CC26022E for ; Mon, 31 Oct 2016 08:03:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A6D029217 for ; Mon, 31 Oct 2016 08:03:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F4092922F; Mon, 31 Oct 2016 08:03:09 +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 AF41629217 for ; Mon, 31 Oct 2016 08:03:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761955AbcJaIDG (ORCPT ); Mon, 31 Oct 2016 04:03:06 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36666 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761999AbcJaIDB (ORCPT ); Mon, 31 Oct 2016 04:03:01 -0400 Received: by mail-pf0-f193.google.com with SMTP id n85so8104494pfi.3 for ; Mon, 31 Oct 2016 01:03:01 -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=WJroG+2J3JOzIkG09Kl+m3a4cV+FeRn0OL8r7lxz1fc=; b=qTuw6zTAo1bJ8O4jH+S2/MSqDfKPtgCO9mlly3BqO7+uOWmJjOpVMfXJJBg0XLPhq0 U5YbLstqinVkUi3elw25aRcN6oRxI3cTH+gLHZjbpA6os6tFw6eVv06gQUNZiJr1JmVB o6Ry+6mbbmN1zIuvdxm8j6+ZTACg7/3luLOQslSp6Yfc6PGACpilMFTDoV0JOVzTGxD2 4H3b58+PSINOdc3IgB9/8tFWfX3v23hHTYEUvguivU07TsuK1BbOny1RqQToX348H9wC FRWCQSrPq1lUNP39NtUBif9mheFIuDVFiysOMqpGz3IgUHqz1sx0qoOS+2/FZGDyhMRc x5zw== 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=WJroG+2J3JOzIkG09Kl+m3a4cV+FeRn0OL8r7lxz1fc=; b=QkflNbwrRYc3VkpLux8hEaFAdDiC8fDt0ZaTnq+aEYKHeraWZ3yGxtIuda4zAGqq2r ZFFmEyWzD19uHlWLBXo55y2Q4ITRlRqxy5IZtcMpUiQfGEgzjgST7Q260T2WT+Opr6pV 4FN1FVu9fJtjwWfHsirukibKrMDFaXXlhpQ7TVG88RjmCyGX2c6vZDSOuV/h5v6r+V7l Eb4c6BTLs02Q3l8tCxriPaf6RfDk4ALByRbDo9hf4t4E+Kr584itzUcfXYQJqG9X8Y28 KVxs7g6WrJF3yB0wK7lleuDYdEy88oEwjYH+iBMhscckxO9IaFGkypKvakfH03yq64Z+ 5BlQ== X-Gm-Message-State: ABUngvfbFLrMtuwzfEGMlcSa/4WxHMzYrmBTH8hT8rrbkgYWxUqDFWa88/ISm4KxfuKvYA== X-Received: by 10.98.58.132 with SMTP id v4mr12694868pfj.7.1477900980651; Mon, 31 Oct 2016 01:03:00 -0700 (PDT) Received: from localhost.localdomain ([216.207.47.6]) by smtp.gmail.com with ESMTPSA id k7sm34121196pan.8.2016.10.31.01.02.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 31 Oct 2016 01:03:00 -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 10/12] mwifiex: sdio: don't check for NULL sdio_func Date: Mon, 31 Oct 2016 16:02:18 +0800 Message-Id: <1477900940-10549-10-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: Brian Norris sdio_func is retrieved via container_of() and should never be NULL. Checking for NULL just makes the logic more confusing than necessary. Stop doing that. Signed-off-by: Brian Norris --- drivers/net/wireless/marvell/mwifiex/sdio.c | 40 +++++++++++------------------ 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c index 375d0a5..8f0f072 100644 --- a/drivers/net/wireless/marvell/mwifiex/sdio.c +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c @@ -231,15 +231,10 @@ static int mwifiex_sdio_resume(struct device *dev) struct mwifiex_adapter *adapter; mmc_pm_flag_t pm_flag = 0; - if (func) { - pm_flag = sdio_get_host_pm_caps(func); - card = sdio_get_drvdata(func); - if (!card || !card->adapter) { - pr_err("resume: invalid card or adapter\n"); - return 0; - } - } else { - pr_err("resume: sdio_func is not specified\n"); + pm_flag = sdio_get_host_pm_caps(func); + card = sdio_get_drvdata(func); + if (!card || !card->adapter) { + dev_err(dev, "resume: invalid card or adapter\n"); return 0; } @@ -320,23 +315,18 @@ static int mwifiex_sdio_suspend(struct device *dev) mmc_pm_flag_t pm_flag = 0; int ret = 0; - if (func) { - pm_flag = sdio_get_host_pm_caps(func); - pr_debug("cmd: %s: suspend: PM flag = 0x%x\n", - sdio_func_id(func), pm_flag); - if (!(pm_flag & MMC_PM_KEEP_POWER)) { - pr_err("%s: cannot remain alive while host is" - " suspended\n", sdio_func_id(func)); - return -ENOSYS; - } + pm_flag = sdio_get_host_pm_caps(func); + pr_debug("cmd: %s: suspend: PM flag = 0x%x\n", + sdio_func_id(func), pm_flag); + if (!(pm_flag & MMC_PM_KEEP_POWER)) { + dev_err(dev, "%s: cannot remain alive while host is" + " suspended\n", sdio_func_id(func)); + return -ENOSYS; + } - card = sdio_get_drvdata(func); - if (!card) { - dev_err(dev, "suspend: invalid card\n"); - return 0; - } - } else { - pr_err("suspend: sdio_func is not specified\n"); + card = sdio_get_drvdata(func); + if (!card) { + dev_err(dev, "suspend: invalid card\n"); return 0; }