Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5749417rwd; Wed, 24 May 2023 06:21:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5PqvRO78D87W7lgyeOhMvJK9oYQ/d+5MRZ1GXKtuDNiVLIppdYbCw2Qn8JfsLhUZVMUE/U X-Received: by 2002:a17:902:a5c7:b0:1ae:50a4:78da with SMTP id t7-20020a170902a5c700b001ae50a478damr14923735plq.67.1684934511535; Wed, 24 May 2023 06:21:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684934511; cv=none; d=google.com; s=arc-20160816; b=jyzLYPAWgVDhmH5Xt/X7O+m51k3nov6//AE66SlcamA1msX/P4wK9cKLZAYPAL1G6j A/DGvuQmJbyD1WAoORpWanPdugjQIycU4Z8sMnNEZguAxCU4L+lbRUdYja8TGyuwzXUp aS/rZVr5M05w79wM+CMC3KNVvEsdcTl+ueGvfSxO3axpFLxRVx6WVWN4to8cFeSGhBsy QXR0WPBZtITBBbMcXrA+rxLxbyqkz10ucWfHyUQwUfS+SNRxIFILmnhQfjHYWSDH9Ip5 Of/9yGA84DQdfEc4td0fIWLOH/Zo29XWcqu+AqB80/5TSa0eFaGS38Ighcq50EoAOt5l bplA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=HhgnwAIyg9ROUXM0L6/ZAuKoK3jhzVh9JsVx69YO1KM=; b=m/fvQqBxWwzE3V5APnhlCGZWSmmUKVDbpxrF8mrLHLa/w63K0U2pIuuElxasoNFvjQ pgkUMLvdmQqXjqUH8KzMTQHZd3SoNPn/zNfwjTlTb+EPz9iWb9dNfD5yLrt0CvZv6AwY P1+QDvgi14L9xQelBhf1nsKiWPbFfgwVGPf47aY6qZptS8tp4Dz5+EnXN3MKz0rgsTjI 6vfRF9Xdx9SS16byb2VEGoc4k0Tw10VZxqlsIYXviJyVke6N3wpofyHTdIeQWMioUuLL MLEOAnpTqWwh2T4bfvIUPHY8w1qltTOWT3EVsgNeyRd9tvh7aYwzjjxQD9OTOCv1er43 EHNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MYDNqTo1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i4-20020a17090332c400b001acb38aa5a5si5464472plr.351.2023.05.24.06.21.34; Wed, 24 May 2023 06:21:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MYDNqTo1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235414AbjEXNL7 (ORCPT + 99 others); Wed, 24 May 2023 09:11:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235351AbjEXNLp (ORCPT ); Wed, 24 May 2023 09:11:45 -0400 Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71DDC1B5 for ; Wed, 24 May 2023 06:11:36 -0700 (PDT) Received: by mail-yb1-xb2e.google.com with SMTP id 3f1490d57ef6-ba1815e12efso838664276.3 for ; Wed, 24 May 2023 06:11:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684933895; x=1687525895; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=HhgnwAIyg9ROUXM0L6/ZAuKoK3jhzVh9JsVx69YO1KM=; b=MYDNqTo1bpq9NIQ3/rF5thaPiqmsb9Qc15tZKJNXUvpKf4mT2K3IcrXWXcArzhqzFt kVXoo67F0C6k4uReBaWd/e83uk78UJTOE+nnEGlBlFw9CF/q5CABWfoJPMWzJuTiStb2 wSt8XU8WHU3o7pi3Yw2pNP/PVoBru9HfXdHilyyRkvcuA8IB1Ks2D8TpVU0t2kBKaQxP +ONHixoNuldTLEVPQG5tLnr5aeQmmrfpRWN4ceWNuIpm8gN/XMd/YV4QYFo5+zB7Jt6y G7v6XW6Z8BuzAModSE/Mvq92x7BlLwiTo4dNVeStwI6Sb++4azsiudcRuZE/+4x/U3kt huwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684933895; x=1687525895; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=HhgnwAIyg9ROUXM0L6/ZAuKoK3jhzVh9JsVx69YO1KM=; b=O1CCl/YwWGELdKYCvB1uaVmjCCrbXmzFVu+I4jL8qZsqUwxyFY/poPoBoApf9DBSGf r1CLNHk0UjlpToAllXrelS/CNKAnP3OtMwkEGPkmVm6YmnXQO2iD+I4WE+aIKUcWYpfs IrpUonzN5Qwv+fm0tHHgulnJI22YQibpwmqgCZ0ElgjH1fAeN3DRxQleP9lsZZa8vbsj N2iS9edrx+zCOLBQ5/NVsqkmhLARB8pK7PMaRGp0mvxHcXk87Y25hRhBbtaVjAeNf9Mj QHdPtltX7eWlxdUkhMLH5mzx9CabOpiDfxh86ltdzkI5GzTaMux5qX6v2sZPYyc2ifxR nx6w== X-Gm-Message-State: AC+VfDx8VYHJ+J0gtK/CRUyBso6jQYCaZyXvkT1WkvU6AnrI4hj/FacL sMklxXpwnDOb1yeQKOv0H+5QgTYU8tkyZKFYt9Ud3HaQy9F2FN9N X-Received: by 2002:a25:407:0:b0:bab:c46f:c7f3 with SMTP id 7-20020a250407000000b00babc46fc7f3mr13165694ybe.24.1684933895541; Wed, 24 May 2023 06:11:35 -0700 (PDT) MIME-Version: 1.0 References: <36e805fa-338d-a945-2621-75c5077572fc@intel.com> <20230518101216.369970-1-asuk4.q@gmail.com> In-Reply-To: <20230518101216.369970-1-asuk4.q@gmail.com> From: Ulf Hansson Date: Wed, 24 May 2023 15:10:59 +0200 Message-ID: Subject: Re: [PATCH] mmc: core: Remove unnecessary error checks and change return type To: Yeqi Fu Cc: CLoehle@hyperstone.com, adrian.hunter@intel.com, avri.altman@wdc.com, axboe@kernel.dk, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 18 May 2023 at 12:13, Yeqi Fu wrote: > > The error checks in mmc_blk_add_debugfs() and mmc_blk_remove_debugfs() > are extraneous. Therefore, this patch removes all error checks from > both functions. > Additionally, mmc_blk_add_debugfs() has been changed to return void > instead of an integer value that was never used. This simplifies the > function and improves its clarity. > > Signed-off-by: Yeqi Fu Applied for next, thanks! Kind regards Uffe > --- > drivers/mmc/core/block.c | 25 +++++++------------------ > 1 file changed, 7 insertions(+), 18 deletions(-) > > diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c > index 00c33edb9fb9..81f33200b893 100644 > --- a/drivers/mmc/core/block.c > +++ b/drivers/mmc/core/block.c > @@ -2894,12 +2894,12 @@ static const struct file_operations mmc_dbg_ext_csd_fops = { > .llseek = default_llseek, > }; > > -static int mmc_blk_add_debugfs(struct mmc_card *card, struct mmc_blk_data *md) > +static void mmc_blk_add_debugfs(struct mmc_card *card, struct mmc_blk_data *md) > { > struct dentry *root; > > if (!card->debugfs_root) > - return 0; > + return; > > root = card->debugfs_root; > > @@ -2908,19 +2908,13 @@ static int mmc_blk_add_debugfs(struct mmc_card *card, struct mmc_blk_data *md) > debugfs_create_file_unsafe("status", 0400, root, > card, > &mmc_dbg_card_status_fops); > - if (!md->status_dentry) > - return -EIO; > } > > if (mmc_card_mmc(card)) { > md->ext_csd_dentry = > debugfs_create_file("ext_csd", S_IRUSR, root, card, > &mmc_dbg_ext_csd_fops); > - if (!md->ext_csd_dentry) > - return -EIO; > } > - > - return 0; > } > > static void mmc_blk_remove_debugfs(struct mmc_card *card, > @@ -2929,22 +2923,17 @@ static void mmc_blk_remove_debugfs(struct mmc_card *card, > if (!card->debugfs_root) > return; > > - if (!IS_ERR_OR_NULL(md->status_dentry)) { > - debugfs_remove(md->status_dentry); > - md->status_dentry = NULL; > - } > + debugfs_remove(md->status_dentry); > + md->status_dentry = NULL; > > - if (!IS_ERR_OR_NULL(md->ext_csd_dentry)) { > - debugfs_remove(md->ext_csd_dentry); > - md->ext_csd_dentry = NULL; > - } > + debugfs_remove(md->ext_csd_dentry); > + md->ext_csd_dentry = NULL; > } > > #else > > -static int mmc_blk_add_debugfs(struct mmc_card *card, struct mmc_blk_data *md) > +static void mmc_blk_add_debugfs(struct mmc_card *card, struct mmc_blk_data *md) > { > - return 0; > } > > static void mmc_blk_remove_debugfs(struct mmc_card *card, > -- > 2.37.2 >