From patchwork Thu Nov 10 11:57:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinming Hu X-Patchwork-Id: 9420971 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 CF93E601C0 for ; Thu, 10 Nov 2016 11:58:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB57B2954D for ; Thu, 10 Nov 2016 11:58:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B0EC8296A1; Thu, 10 Nov 2016 11:58:14 +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 496E22954D for ; Thu, 10 Nov 2016 11:58:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755710AbcKJL6E (ORCPT ); Thu, 10 Nov 2016 06:58:04 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34989 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754303AbcKJL6D (ORCPT ); Thu, 10 Nov 2016 06:58:03 -0500 Received: by mail-pf0-f195.google.com with SMTP id i88so3963286pfk.2 for ; Thu, 10 Nov 2016 03:58:03 -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=/E/RV5P2XbIpLLU0hFqJX4RqjADD6/BCXiVw4zncw0o=; b=DCThbT3Zv7Pkjy/Si6z5cfArcRP+IF/2BXD8xqmLOYaUFktM+ULrt8ZPiTGEGoMJ6z ShcMHPspdZet6qDJnJ549ARXIp+3z8CdLwsUxs66e+WSXj4q+pLeXRrgHoMj6WUwAqQ2 65ca6hbPTn0MUw1ofeQCBKGui8chzjyp0pCuPwulYiXO4a4z9ke3Jx2JtUF+hyoT/FCt cXI5BOnJsBrLW0tMxR0dCpYTNngVw4sm1wDZPPgMnqytJ7Z9XEnW8xA3YQotFXj9uCHO j92CU/qqz7FQG/E8BbZJRhvqQHr0/pRcIHbO+LElM/jvXAVlySNQqvNelFCoD3bA12aj kAMw== 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=/E/RV5P2XbIpLLU0hFqJX4RqjADD6/BCXiVw4zncw0o=; b=QCt1PpaQftILsCagSNLaiSdyhHnmQ90mChYMAhZvDOngePGf4EYLXndJjNipce39fo 1nfw/CKC3vet5RRqpCSguD4sawW2CMlG6o3mGCfGHe5VmqdUdmFRZz21RdorqzqGNTIF Mlw2cKm0asG+0obuj+4fY6KoYZWa+3oZ/AEISCjr53F98dB61vsexXeN8gEGsBD1gDvW UX5P2q2mcTIgu/LCxGjwbfO5jtlTjXnX04xST3l3ZkH6F9kWjryb2VpfRhAkJnlwZYBF rh7yFXWwPfsBCvAUV4/UN4MpOmiC1rcLuI9QTzo20g5dxIom/CwKz/Jpk9nBAd0fS8j3 T3dw== X-Gm-Message-State: ABUngveXxettkl7XpB5k0GSZbaTNLhojKsDo4TwKRT0rQn8+LGm41xiltJlVP5J7bJXk+Q== X-Received: by 10.99.10.20 with SMTP id 20mr22825350pgk.98.1478779082601; Thu, 10 Nov 2016 03:58:02 -0800 (PST) Received: from localhost.localdomain ([216.207.47.6]) by smtp.gmail.com with ESMTPSA id v10sm6740890pag.44.2016.11.10.03.58.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Nov 2016 03:58:02 -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 09/11] mwifiex: sdio: don't check for NULL sdio_func Date: Thu, 10 Nov 2016 19:57:10 +0800 Message-Id: <1478779032-5165-9-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: 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 --- v2: Same as v1 --- 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 4c4b012..bee7326 100644 --- a/drivers/net/wireless/marvell/mwifiex/sdio.c +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c @@ -190,15 +190,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; } @@ -274,23 +269,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; }