From patchwork Wed Nov 2 02:24:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinming Hu X-Patchwork-Id: 9408407 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 A304160721 for ; Wed, 2 Nov 2016 02:26:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F4D529D2A for ; Wed, 2 Nov 2016 02:26:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82C2C29D2C; Wed, 2 Nov 2016 02:26:18 +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 CD92229D2B for ; Wed, 2 Nov 2016 02:26:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755286AbcKBC0N (ORCPT ); Tue, 1 Nov 2016 22:26:13 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:36071 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755278AbcKBC0M (ORCPT ); Tue, 1 Nov 2016 22:26:12 -0400 Received: by mail-pf0-f194.google.com with SMTP id n85so263058pfi.3 for ; Tue, 01 Nov 2016 19:26:11 -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=dtUrOahC/AuVaPeTYePVsVKJj6cOUC8lflts7kSx1m0=; b=ynlnmm9otn5Joprbw4uCIDYyBMspEDlDJwXl2V8i2Ov9mA2w8EoNw1EYyWsQCYYSud ApCSwo1lNrYmv5NNLxwtREFRji/sCpTET69WejHAMwaaZM839st5y3AxxaSCvM22KCrQ +PiRavZeTGyCiMKP8MdoZLbfUo14XKfwGgOSDuTMXFSM1AbZ3xsOBXdzKt1gsg0AghQN KJggGt4bLaHLlajppXiz4GZTQL8fbwu2HrG6wPKOnkQ2ejvHsSXhy9lrzG3hHYOfNTau 6d37FflmGRfnzUd6azb9RnsO8PqLus9Qp7asyT+fNWziynbQbyrl7C3tixYPFu/67fIL V2Tw== 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=dtUrOahC/AuVaPeTYePVsVKJj6cOUC8lflts7kSx1m0=; b=X5BJO1Q0wjSFkLkxF88UtUCWP/yzL+d7XSM2NXRz0coHbDThb94qC91SSIgzZoZ6Hl RZH9HBde2H7L9tesCHF2dE0yEc/jaH5Kipmoe5r9/hpVJcvasPR7hAd7IUjhljpWsZj0 Lv0OyQiIc9UPlGk+VzKb4+c67RjaseXt/8DY4Q82axd70vxyQpXV2IHTTnjDfIpIhiL6 hpq7LKcajOyS4Il74MVRNa5t/GZfIWXAGTpBFs1vUBYLSzXrIjeLhEC3Gb+wtTuDwsys g5DlzjFuNVcxMoUr65Hey/Roz/ENlKuQSGwn78z0+9PTORlcAUjfMIF3D27W+sYfAyc/ TzsA== X-Gm-Message-State: ABUngvcT2sIDu+j0kfOTUlBdRLcuexQ9EcL44lkiQQb6Rp9IL7+cl70QWKk6ZdhNKJNJ/Q== X-Received: by 10.99.164.9 with SMTP id c9mr1885228pgf.173.1478053571443; Tue, 01 Nov 2016 19:26:11 -0700 (PDT) Received: from localhost.localdomain ([216.207.47.6]) by smtp.gmail.com with ESMTPSA id tx10sm36409076pab.40.2016.11.01.19.26.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Nov 2016 19:26:11 -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 10/12] mwifiex: sdio: don't check for NULL sdio_func Date: Wed, 2 Nov 2016 10:24:46 +0800 Message-Id: <1478053488-16042-8-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 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. --- v2: Same as v1 --- 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; }