Message ID | 20221130092847.2092-1-thunder.leizhen@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp821694wrr; Wed, 30 Nov 2022 01:33:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf5uqfPeBZf/sipIMJGmCi5iR2j3ed0bcwfmspwBKe/QFhFCDXniAOGs/CqS/IMKYxeXo8Yy X-Received: by 2002:a17:907:8b93:b0:7b4:f258:6196 with SMTP id tb19-20020a1709078b9300b007b4f2586196mr37382264ejc.524.1669800804955; Wed, 30 Nov 2022 01:33:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669800804; cv=none; d=google.com; s=arc-20160816; b=z5oeADz8VBSoh3KhdIzl/2kOoi5DD7uWfg9ZOB44xbs/VYmMxegvGIegiXkZQK08V9 Rdn1b5NK4UuBQb82cx91GZGwuGl23IkaK/e6JqYYGWGMGq7fFakaamSU17kxaf8TIs0Z CANeCYF0rfjm090hVwFVL8hsLJG4O6K0ggUsEbt4RRCz/aGuHcsOPhNtWdoUrPvIaqDQ p4dbETukGAJpy3nbluUxHg7CDkLB+OHoYN/lUHUABIrwdkBT6yslHbL5SRc379AE9jDs pD2x8kZZPjFwgJehZSrT+RjoBXs4Mf50lE3FcqjwcfqN2GVwLGvhqzA90Rsgn4uVdCtf KpVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=KX/qPiqEt50lr8HEdUXgiF7PFTbZrgvzFLi5UU9JZ34=; b=uOHiq9dlVlYxAXfIi6AFwoX336yP5gFyvHMCmYvaRMsefOfxAM3E1xelF0Mfgsbk0d /2i5DlR/Vcd76gs4Mn8Ol1gJjrOAvV6U7k/m97J+4MUNtwy4+jtD4twKeasK6Tyio0s0 U8bVtDB1O8SV0Xr/IREXA5A8zXQ9uOkTX2DUcIk3EGOlRgdoOh0RlJhYOVjAHM43J9Ru WA7QY0eQn3lCXYGwmgnYwbjkd7AU6ws8gK+zvu/NcNFDv4jSLn3U4JHmInwbvwHkGDOO box32LYMsvNOhucKUtfCfVYLtc5UXhW6gX0p9b4Y1oOMPrqc86BcbQJidauJ41pNVXFN fyHQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp8-20020a1709073e0800b0078d027ceb41si969014ejc.857.2022.11.30.01.33.01; Wed, 30 Nov 2022 01:33:24 -0800 (PST) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233498AbiK3J30 (ORCPT <rfc822;heyuhang3455@gmail.com> + 99 others); Wed, 30 Nov 2022 04:29:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233469AbiK3J3S (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 30 Nov 2022 04:29:18 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBD1B37230; Wed, 30 Nov 2022 01:29:13 -0800 (PST) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4NMYj84WRzzJp4N; Wed, 30 Nov 2022 17:25:48 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 30 Nov 2022 17:29:12 +0800 Received: from thunder-town.china.huawei.com (10.174.178.55) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 30 Nov 2022 17:29:11 +0800 From: Zhen Lei <thunder.leizhen@huawei.com> To: Ulf Hansson <ulf.hansson@linaro.org>, <linux-mmc@vger.kernel.org>, <linux-kernel@vger.kernel.org> CC: Zhen Lei <thunder.leizhen@huawei.com> Subject: [PATCH] mmc: core: Fix error return code in sd_read_ext_regs() Date: Wed, 30 Nov 2022 17:28:47 +0800 Message-ID: <20221130092847.2092-1-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.37.3.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.174.178.55] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750913049086490963?= X-GMAIL-MSGID: =?utf-8?q?1750913049086490963?= |
Series |
mmc: core: Fix error return code in sd_read_ext_regs()
|
|
Commit Message
Zhen Lei
Nov. 30, 2022, 9:28 a.m. UTC
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.
Fixes: c784f92769ae ("mmc: core: Read the SD function extension registers for power management")
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
drivers/mmc/core/sd.c | 1 +
1 file changed, 1 insertion(+)
Comments
On Wed, 30 Nov 2022 at 10:29, Zhen Lei <thunder.leizhen@huawei.com> wrote: > > Fix to return a negative error code from the error handling > case instead of 0, as done elsewhere in this function. > > Fixes: c784f92769ae ("mmc: core: Read the SD function extension registers for power management") > Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> > --- > drivers/mmc/core/sd.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c > index 3662bf5320ce56d..7b64f76f0179ca8 100644 > --- a/drivers/mmc/core/sd.c > +++ b/drivers/mmc/core/sd.c > @@ -1277,6 +1277,7 @@ static int sd_read_ext_regs(struct mmc_card *card) > if (rev != 0 || len > 512) { > pr_warn("%s: non-supported SD ext reg layout\n", > mmc_hostname(card->host)); > + err = -EOPNOTSUPP; The original intent was to not return an error code. Simply, because the card remains functional and all but the new features from the SD function extensions registers can still be used. Perhaps, we should update the comment a few lines above to better reflect that this is in-fact what we intend here. > goto out; > } > Kind regards Uffe
On 2022/11/30 18:04, Ulf Hansson wrote: > On Wed, 30 Nov 2022 at 10:29, Zhen Lei <thunder.leizhen@huawei.com> wrote: >> >> Fix to return a negative error code from the error handling >> case instead of 0, as done elsewhere in this function. >> >> Fixes: c784f92769ae ("mmc: core: Read the SD function extension registers for power management") >> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> >> --- >> drivers/mmc/core/sd.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c >> index 3662bf5320ce56d..7b64f76f0179ca8 100644 >> --- a/drivers/mmc/core/sd.c >> +++ b/drivers/mmc/core/sd.c >> @@ -1277,6 +1277,7 @@ static int sd_read_ext_regs(struct mmc_card *card) >> if (rev != 0 || len > 512) { >> pr_warn("%s: non-supported SD ext reg layout\n", >> mmc_hostname(card->host)); >> + err = -EOPNOTSUPP; > > The original intent was to not return an error code. Simply, because > the card remains functional and all but the new features from the SD > function extensions registers can still be used. OK, I got it. > > Perhaps, we should update the comment a few lines above to better > reflect that this is in-fact what we intend here. How about also add 'warning' to the output? The other two outputs contain the 'error' keyword. > >> goto out; >> } >> > > Kind regards > Uffe > . >
On Wed, 30 Nov 2022 at 12:18, Leizhen (ThunderTown) <thunder.leizhen@huawei.com> wrote: > > > > On 2022/11/30 18:04, Ulf Hansson wrote: > > On Wed, 30 Nov 2022 at 10:29, Zhen Lei <thunder.leizhen@huawei.com> wrote: > >> > >> Fix to return a negative error code from the error handling > >> case instead of 0, as done elsewhere in this function. > >> > >> Fixes: c784f92769ae ("mmc: core: Read the SD function extension registers for power management") > >> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> > >> --- > >> drivers/mmc/core/sd.c | 1 + > >> 1 file changed, 1 insertion(+) > >> > >> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c > >> index 3662bf5320ce56d..7b64f76f0179ca8 100644 > >> --- a/drivers/mmc/core/sd.c > >> +++ b/drivers/mmc/core/sd.c > >> @@ -1277,6 +1277,7 @@ static int sd_read_ext_regs(struct mmc_card *card) > >> if (rev != 0 || len > 512) { > >> pr_warn("%s: non-supported SD ext reg layout\n", > >> mmc_hostname(card->host)); > >> + err = -EOPNOTSUPP; > > > > The original intent was to not return an error code. Simply, because > > the card remains functional and all but the new features from the SD > > function extensions registers can still be used. > > OK, I got it. > > > > > Perhaps, we should update the comment a few lines above to better > > reflect that this is in-fact what we intend here. > > How about also add 'warning' to the output? The other two outputs > contain the 'error' keyword. There is already a pr_warn(), or is there something you want to add to that? > > > > >> goto out; > >> } > >> Kind regards Uffe
On 2022/11/30 19:33, Ulf Hansson wrote: > On Wed, 30 Nov 2022 at 12:18, Leizhen (ThunderTown) > <thunder.leizhen@huawei.com> wrote: >> >> >> >> On 2022/11/30 18:04, Ulf Hansson wrote: >>> On Wed, 30 Nov 2022 at 10:29, Zhen Lei <thunder.leizhen@huawei.com> wrote: >>>> >>>> Fix to return a negative error code from the error handling >>>> case instead of 0, as done elsewhere in this function. >>>> >>>> Fixes: c784f92769ae ("mmc: core: Read the SD function extension registers for power management") >>>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> >>>> --- >>>> drivers/mmc/core/sd.c | 1 + >>>> 1 file changed, 1 insertion(+) >>>> >>>> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c >>>> index 3662bf5320ce56d..7b64f76f0179ca8 100644 >>>> --- a/drivers/mmc/core/sd.c >>>> +++ b/drivers/mmc/core/sd.c >>>> @@ -1277,6 +1277,7 @@ static int sd_read_ext_regs(struct mmc_card *card) >>>> if (rev != 0 || len > 512) { >>>> pr_warn("%s: non-supported SD ext reg layout\n", >>>> mmc_hostname(card->host)); >>>> + err = -EOPNOTSUPP; >>> >>> The original intent was to not return an error code. Simply, because >>> the card remains functional and all but the new features from the SD >>> function extensions registers can still be used. >> >> OK, I got it. >> >>> >>> Perhaps, we should update the comment a few lines above to better >>> reflect that this is in-fact what we intend here. >> >> How about also add 'warning' to the output? The other two outputs >> contain the 'error' keyword. > > There is already a pr_warn(), or is there something you want to add to that? No, I don't have anything else to add. I just saw the other two error outputs are also use pr_warn(). Maybe they need to be changed to pr_err(). > >> >>> >>>> goto out; >>>> } >>>> > > Kind regards > Uffe > . >
On Wed, 30 Nov 2022 at 12:45, Leizhen (ThunderTown) <thunder.leizhen@huawei.com> wrote: > > > > On 2022/11/30 19:33, Ulf Hansson wrote: > > On Wed, 30 Nov 2022 at 12:18, Leizhen (ThunderTown) > > <thunder.leizhen@huawei.com> wrote: > >> > >> > >> > >> On 2022/11/30 18:04, Ulf Hansson wrote: > >>> On Wed, 30 Nov 2022 at 10:29, Zhen Lei <thunder.leizhen@huawei.com> wrote: > >>>> > >>>> Fix to return a negative error code from the error handling > >>>> case instead of 0, as done elsewhere in this function. > >>>> > >>>> Fixes: c784f92769ae ("mmc: core: Read the SD function extension registers for power management") > >>>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> > >>>> --- > >>>> drivers/mmc/core/sd.c | 1 + > >>>> 1 file changed, 1 insertion(+) > >>>> > >>>> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c > >>>> index 3662bf5320ce56d..7b64f76f0179ca8 100644 > >>>> --- a/drivers/mmc/core/sd.c > >>>> +++ b/drivers/mmc/core/sd.c > >>>> @@ -1277,6 +1277,7 @@ static int sd_read_ext_regs(struct mmc_card *card) > >>>> if (rev != 0 || len > 512) { > >>>> pr_warn("%s: non-supported SD ext reg layout\n", > >>>> mmc_hostname(card->host)); > >>>> + err = -EOPNOTSUPP; > >>> > >>> The original intent was to not return an error code. Simply, because > >>> the card remains functional and all but the new features from the SD > >>> function extensions registers can still be used. > >> > >> OK, I got it. > >> > >>> > >>> Perhaps, we should update the comment a few lines above to better > >>> reflect that this is in-fact what we intend here. > >> > >> How about also add 'warning' to the output? The other two outputs > >> contain the 'error' keyword. > > > > There is already a pr_warn(), or is there something you want to add to that? > > No, I don't have anything else to add. > > I just saw the other two error outputs are also use pr_warn(). Maybe they > need to be changed to pr_err(). Aha, that's a good point! We should change those to pr_err(). Kind regards Uffe
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 3662bf5320ce56d..7b64f76f0179ca8 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -1277,6 +1277,7 @@ static int sd_read_ext_regs(struct mmc_card *card) if (rev != 0 || len > 512) { pr_warn("%s: non-supported SD ext reg layout\n", mmc_hostname(card->host)); + err = -EOPNOTSUPP; goto out; }