lkml.org 
[lkml]   [2022]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: Re: [PATCH] ACPI: LPSS: Fix missing check in register_device_clock
On Fri, Jun 24, 2022 at 4:35 AM huhai <15815827059@163.com> wrote:
>
>
> At 2022-06-23 21:25:55, "Rafael J. Wysocki" <rafael@kernel.org> wrote:
> >On Thu, Jun 23, 2022 at 3:21 PM huhai <15815827059@163.com> wrote:
> >>
> >> From: huhai <huhai@kylinos.cn>
> >>
> >> register_device_clock() misses a check for platform_device_register_simple().
> >> Add a check to fix it.
> >>
> >> Signed-off-by: huhai <huhai@kylinos.cn>
> >> ---
> >> drivers/acpi/acpi_lpss.c | 3 +++
> >> 1 file changed, 3 insertions(+)
> >>
> >> diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
> >> index fbe0756259c5..c4d4d21391d7 100644
> >> --- a/drivers/acpi/acpi_lpss.c
> >> +++ b/drivers/acpi/acpi_lpss.c
> >> @@ -422,6 +422,9 @@ static int register_device_clock(struct acpi_device *adev,
> >> if (!lpss_clk_dev)
> >> lpt_register_clock_device();
> >>
> >> + if (IS_ERR(lpss_clk_dev))
> >> + return PTR_ERR(lpss_clk_dev);
> >> +
> >
> >Why not use IS_ERR_OR_NULL() instead?
>
> platform_device_register_simple() never returns NULL as it declared bellowing,
> so use IS_ERR() to validate the return value should be enough.
>
> /**
> * platform_device_register_simple - add a platform-level device and its resources
> * ...
> * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
> */

Fair enough.

Applied as 5.20 material, thanks!

\
 
 \ /
  Last update: 2022-06-29 20:22    [W:0.047 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site