mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: huhai <15815827059@163.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: "Len Brown" <lenb@kernel.org>,
	"ACPI Devel Maling List" <linux-acpi@vger.kernel.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	huhai <huhai@kylinos.cn>
Subject: Re:Re: [PATCH] ACPI: LPSS: Fix missing check in register_device_clock
Date: Fri, 24 Jun 2022 10:20:29 +0800 (CST)	[thread overview]
Message-ID: <18367cc4.16aa.1819382c273.Coremail.15815827059@163.com> (raw)
In-Reply-To: <CAJZ5v0jC+B7K0uuE=wLi1hk+WATn5B8sSu6abSO00rYJ4ofRFw@mail.gmail.com>


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

Thanks.

>
>>         clk_data = platform_get_drvdata(lpss_clk_dev);
>>         if (!clk_data)
>>                 return -ENODEV;
>> --
>> 2.27.0
>>
>>
>> No virus found
>>                 Checked by Hillstone Network AntiVirus
>>

  reply	other threads:[~2022-06-24  2:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-23 13:21 huhai
2022-06-23 13:25 ` Rafael J. Wysocki
2022-06-24  2:20   ` huhai [this message]
2022-06-29 18:20     ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18367cc4.16aa.1819382c273.Coremail.15815827059@163.com \
    --to=15815827059@163.com \
    --cc=huhai@kylinos.cn \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®