linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ACPI: CPPC: fix return value in register_pcc_channel()
@ 2021-10-22  7:39 Kai Song
  2021-10-22 12:36 ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Kai Song @ 2021-10-22  7:39 UTC (permalink / raw)
  To: rafael, lenb; +Cc: linux-acpi, linux-kernel, Kai Song

It uses IS_ERR to judge the return value of
pcc_mbox_request_channel().If it is invalid, maybe we should
use PTR_ERR to get the correct return value.

Signed-off-by: Kai Song <songkai01@inspur.com>
---
 drivers/acpi/cppc_acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
index bd482108310c..0bbb5fa27ce7 100644
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -503,7 +503,7 @@ static int register_pcc_channel(int pcc_ss_idx)
 		if (IS_ERR(pcc_data[pcc_ss_idx]->pcc_channel)) {
 			pr_err("Failed to find PCC channel for subspace %d\n",
 			       pcc_ss_idx);
-			return -ENODEV;
+			return PTR_ERR(pcc_data[pcc_ss_idx]->pcc_channel);
 		}
 
 		/*
-- 
2.27.0


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

* Re: [PATCH] ACPI: CPPC: fix return value in register_pcc_channel()
  2021-10-22  7:39 [PATCH] ACPI: CPPC: fix return value in register_pcc_channel() Kai Song
@ 2021-10-22 12:36 ` Rafael J. Wysocki
  2021-10-25  0:55   ` 答复: [gmail.com代发]Re: " Harris Song
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2021-10-22 12:36 UTC (permalink / raw)
  To: Kai Song
  Cc: Rafael J. Wysocki, Len Brown, ACPI Devel Maling List,
	Linux Kernel Mailing List

On Fri, Oct 22, 2021 at 9:39 AM Kai Song <songkai01@inspur.com> wrote:
>
> It uses IS_ERR to judge the return value of
> pcc_mbox_request_channel().If it is invalid, maybe we should
> use PTR_ERR to get the correct return value.

Either there is a reason to make this change or there isn't.

If there is a reason, then what is it?

> Signed-off-by: Kai Song <songkai01@inspur.com>
> ---
>  drivers/acpi/cppc_acpi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
> index bd482108310c..0bbb5fa27ce7 100644
> --- a/drivers/acpi/cppc_acpi.c
> +++ b/drivers/acpi/cppc_acpi.c
> @@ -503,7 +503,7 @@ static int register_pcc_channel(int pcc_ss_idx)
>                 if (IS_ERR(pcc_data[pcc_ss_idx]->pcc_channel)) {
>                         pr_err("Failed to find PCC channel for subspace %d\n",
>                                pcc_ss_idx);
> -                       return -ENODEV;
> +                       return PTR_ERR(pcc_data[pcc_ss_idx]->pcc_channel);
>                 }
>
>                 /*
> --
> 2.27.0
>

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

* 答复: [gmail.com代发]Re: [PATCH] ACPI: CPPC: fix return value in register_pcc_channel()
  2021-10-22 12:36 ` Rafael J. Wysocki
@ 2021-10-25  0:55   ` Harris Song
  0 siblings, 0 replies; 3+ messages in thread
From: Harris Song @ 2021-10-25  0:55 UTC (permalink / raw)
  To: rafael; +Cc: lenb, linux-acpi, linux-kernel

> On Fri, Oct 22, 2021 at 9:39 AM Kai Song <songkai01@inspur.com> wrote:
> >
> > It uses IS_ERR to judge the return value of
> > pcc_mbox_request_channel().If it is invalid, maybe we should use
> > PTR_ERR to get the correct return value.
>
> Either there is a reason to make this change or there isn't.
>
> If there is a reason, then what is it?

Thank you for your reminding,  pcc_mbox_request_channel() has other return values like -EBUSY.
But I checked through  the  context , it seems  -ENODEV is ok.

So this patch seems harmless but not needed.
Thank you for your time.

Kai

> > Signed-off-by: Kai Song <songkai01@inspur.com>
> > ---
> >  drivers/acpi/cppc_acpi.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index
> > bd482108310c..0bbb5fa27ce7 100644
> > --- a/drivers/acpi/cppc_acpi.c
> > +++ b/drivers/acpi/cppc_acpi.c
> > @@ -503,7 +503,7 @@ static int register_pcc_channel(int pcc_ss_idx)
> >                 if (IS_ERR(pcc_data[pcc_ss_idx]->pcc_channel)) {
> >                         pr_err("Failed to find PCC channel for subspace %d\n",
> >                                pcc_ss_idx);
> > -                       return -ENODEV;
> > +                       return
> > + PTR_ERR(pcc_data[pcc_ss_idx]->pcc_channel);
> >                 }
> >
> >                 /*
> > --
> > 2.27.0
> >

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

end of thread, other threads:[~2021-10-25  0:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-22  7:39 [PATCH] ACPI: CPPC: fix return value in register_pcc_channel() Kai Song
2021-10-22 12:36 ` Rafael J. Wysocki
2021-10-25  0:55   ` 答复: [gmail.com代发]Re: " Harris Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).