mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mmc: core: Fix error return code in sd_read_ext_regs()
@ 2022-11-30  9:28 Zhen Lei
  2022-11-30 10:04 ` Ulf Hansson
  0 siblings, 1 reply; 6+ messages in thread
From: Zhen Lei @ 2022-11-30  9:28 UTC (permalink / raw)
  To: Ulf Hansson, linux-mmc, linux-kernel; +Cc: Zhen Lei

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;
 		goto out;
 	}
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mmc: core: Fix error return code in sd_read_ext_regs()
  2022-11-30  9:28 [PATCH] mmc: core: Fix error return code in sd_read_ext_regs() Zhen Lei
@ 2022-11-30 10:04 ` Ulf Hansson
  2022-11-30 11:18   ` Leizhen (ThunderTown)
  0 siblings, 1 reply; 6+ messages in thread
From: Ulf Hansson @ 2022-11-30 10:04 UTC (permalink / raw)
  To: Zhen Lei; +Cc: linux-mmc, linux-kernel

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mmc: core: Fix error return code in sd_read_ext_regs()
  2022-11-30 10:04 ` Ulf Hansson
@ 2022-11-30 11:18   ` Leizhen (ThunderTown)
  2022-11-30 11:33     ` Ulf Hansson
  0 siblings, 1 reply; 6+ messages in thread
From: Leizhen (ThunderTown) @ 2022-11-30 11:18 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, linux-kernel



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
> .
> 

-- 
Regards,
  Zhen Lei

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mmc: core: Fix error return code in sd_read_ext_regs()
  2022-11-30 11:18   ` Leizhen (ThunderTown)
@ 2022-11-30 11:33     ` Ulf Hansson
  2022-11-30 11:44       ` Leizhen (ThunderTown)
  0 siblings, 1 reply; 6+ messages in thread
From: Ulf Hansson @ 2022-11-30 11:33 UTC (permalink / raw)
  To: Leizhen (ThunderTown); +Cc: linux-mmc, linux-kernel

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mmc: core: Fix error return code in sd_read_ext_regs()
  2022-11-30 11:33     ` Ulf Hansson
@ 2022-11-30 11:44       ` Leizhen (ThunderTown)
  2022-11-30 11:51         ` Ulf Hansson
  0 siblings, 1 reply; 6+ messages in thread
From: Leizhen (ThunderTown) @ 2022-11-30 11:44 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, linux-kernel



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
> .
> 

-- 
Regards,
  Zhen Lei

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mmc: core: Fix error return code in sd_read_ext_regs()
  2022-11-30 11:44       ` Leizhen (ThunderTown)
@ 2022-11-30 11:51         ` Ulf Hansson
  0 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2022-11-30 11:51 UTC (permalink / raw)
  To: Leizhen (ThunderTown); +Cc: linux-mmc, linux-kernel

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-11-30 11:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-30  9:28 [PATCH] mmc: core: Fix error return code in sd_read_ext_regs() Zhen Lei
2022-11-30 10:04 ` Ulf Hansson
2022-11-30 11:18   ` Leizhen (ThunderTown)
2022-11-30 11:33     ` Ulf Hansson
2022-11-30 11:44       ` Leizhen (ThunderTown)
2022-11-30 11:51         ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®