Re: [PATCH] platform/x86: hsmp: Check ACPI_COMPANION() against NULL

Carlos Bilbao <[email protected]>
Newsgroups org.kernel.vger.platform-driver-x86
Message-ID <[email protected]>
Hello Jiale,


On 7/12/26 08:55, Jiale Yao wrote:

> Add a requisite ACPI_COMPANION() check against NULL to the
> AMD HSMP acpi probe, aligning with the fix applied to
> asus-wireless driver.


And I'm supposed to know what fix is that? This looks like AI slop.


>
> Signed-off-by: Jiale Yao <[email protected]>
> ---
>   drivers/platform/x86/amd/hsmp/acpi.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/platform/x86/amd/hsmp/acpi.c b/drivers/platform/x86/amd/hsmp/acpi.c
> index 97ed71593bdf..615b3ebe66e7 100644
> --- a/drivers/platform/x86/amd/hsmp/acpi.c
> +++ b/drivers/platform/x86/amd/hsmp/acpi.c
> @@ -71,6 +71,8 @@ static inline int hsmp_get_uid(struct device *dev, u16 *sock_ind)
>   {
>   	char *uid;
>   
> +	if (!ACPI_COMPANION(dev))
> +		return -ENODEV;


Nothing wrong with this, but you should also check uid after:

uid = acpi_device_uid(ACPI_COMPANION(dev));

since it itself can also be NULL.


>   	/*
>   	 * UID (ID00, ID01..IDXX) is used for differentiating sockets,
>   	 * read it and strip the "ID" part of it and convert the remaining


Thanks,

Carlos
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.