[PATCH] platform/x86: asus-wireless: Check ACPI_COMPANION() against NULL

Jiale Yao posted 1 patch 1 week, 6 days ago
drivers/platform/x86/asus-wireless.c | 3 +++
1 file changed, 3 insertions(+)
[PATCH] platform/x86: asus-wireless: Check ACPI_COMPANION() against NULL
Posted by Jiale Yao 1 week, 6 days ago
Every platform driver can be forced to match a device that doesn't match
its list of device IDs because of device_match_driver_override(), so
platform drivers that rely on the existence of a device's ACPI companion
object need to verify its presence.

Accordingly, add a requisite ACPI_COMPANION() check against NULL to the
asus-wireless driver.

Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
 drivers/platform/x86/asus-wireless.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/platform/x86/asus-wireless.c b/drivers/platform/x86/asus-wireless.c
index 2b494bf3cba8..54052bda9061 100644
--- a/drivers/platform/x86/asus-wireless.c
+++ b/drivers/platform/x86/asus-wireless.c
@@ -132,6 +132,9 @@ static int asus_wireless_probe(struct platform_device *pdev)
 	const struct acpi_device_id *id;
 	int err;
 
+	if (!adev)
+		return -ENODEV;
+
 	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
 	if (!data)
 		return -ENOMEM;
-- 
2.34.1
Re: [PATCH] platform/x86: asus-wireless: Check ACPI_COMPANION() against NULL
Posted by Ilpo Järvinen 1 week, 5 days ago
On Sun, 12 Jul 2026, Jiale Yao wrote:

You've an extra space in the subject in all of these.

Also, please send similar patches for different drivers in a series so 
it's easier for me to apply them in a one go.

--
 i.

> Every platform driver can be forced to match a device that doesn't match
> its list of device IDs because of device_match_driver_override(), so
> platform drivers that rely on the existence of a device's ACPI companion
> object need to verify its presence.
> 
> Accordingly, add a requisite ACPI_COMPANION() check against NULL to the
> asus-wireless driver.
> 
> Signed-off-by: Jiale Yao <yaojiale02@163.com>
> ---
>  drivers/platform/x86/asus-wireless.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/platform/x86/asus-wireless.c b/drivers/platform/x86/asus-wireless.c
> index 2b494bf3cba8..54052bda9061 100644
> --- a/drivers/platform/x86/asus-wireless.c
> +++ b/drivers/platform/x86/asus-wireless.c
> @@ -132,6 +132,9 @@ static int asus_wireless_probe(struct platform_device *pdev)
>  	const struct acpi_device_id *id;
>  	int err;
>  
> +	if (!adev)
> +		return -ENODEV;
> +
>  	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
>  	if (!data)
>  		return -ENOMEM;
>