The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v2 00/16] platform/x86: Check ACPI_COMPANION() against NULL during probe
@ 2026-05-12 14:01 Rafael J. Wysocki
  2026-05-12 14:03 ` [PATCH v2 01/16] platform/x86: acer-wireless: Check ACPI_COMPANION() against NULL Rafael J. Wysocki
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 14:01 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Corentin Chary, Luke D. Jones,
	Denis Benato, Pali Rohár, Jonathan Woithe, Robert Gerlach,
	Matan Ziv-Av, Kenneth Chan, Mattia Dongili, Jeremy Soller,
	Azael Avalos, Andy Shevchenko, platform-driver-x86

Hi All,

This series replaces

https://lore.kernel.org/linux-acpi/5990022.DvuYhMxLoT@rafael.j.wysocki/

and, as a whole, it makes exactly the same code changes.

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, requisite ACPI_COMPANION() or ACPI_HANDLE() checks against NULL
are added to multiple platform/x86 drivers that have been converted to platform
drivers from ACPI drivers recently.

Thanks!




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

* [PATCH v2 01/16] platform/x86: acer-wireless: Check ACPI_COMPANION() against NULL
  2026-05-12 14:01 [PATCH v2 00/16] platform/x86: Check ACPI_COMPANION() against NULL during probe Rafael J. Wysocki
@ 2026-05-12 14:03 ` Rafael J. Wysocki
  2026-05-12 14:04 ` [PATCH v2 02/16] platform/x86: asus-laptop: " Rafael J. Wysocki
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 14:03 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Corentin Chary, Luke D. Jones,
	Denis Benato, Pali Rohár, Jonathan Woithe, Robert Gerlach,
	Matan Ziv-Av, Kenneth Chan, Mattia Dongili, Jeremy Soller,
	Azael Avalos, Andy Shevchenko, platform-driver-x86

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

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
platform/x86 acer-wireless driver.

Fixes: f7e648027d7e ("platform/x86: acer-wireless: Convert ACPI driver to a platform one")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/platform/x86/acer-wireless.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/acer-wireless.c b/drivers/platform/x86/acer-wireless.c
index f464b13a58af..fae8e5ad0f97 100644
--- a/drivers/platform/x86/acer-wireless.c
+++ b/drivers/platform/x86/acer-wireless.c
@@ -37,9 +37,14 @@ static void acer_wireless_notify(acpi_handle handle, u32 event, void *data)
 
 static int acer_wireless_probe(struct platform_device *pdev)
 {
+	struct acpi_device *adev;
 	struct input_dev *idev;
 	int ret;
 
+	adev = ACPI_COMPANION(&pdev->dev);
+	if (!adev)
+		return -ENODEV;
+
 	idev = devm_input_allocate_device(&pdev->dev);
 	if (!idev)
 		return -ENOMEM;
@@ -57,8 +62,7 @@ static int acer_wireless_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	return acpi_dev_install_notify_handler(ACPI_COMPANION(&pdev->dev),
-					       ACPI_DEVICE_NOTIFY,
+	return acpi_dev_install_notify_handler(adev, ACPI_DEVICE_NOTIFY,
 					       acer_wireless_notify,
 					       &pdev->dev);
 }
-- 
2.51.0





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

* [PATCH v2 02/16] platform/x86: asus-laptop: Check ACPI_COMPANION() against NULL
  2026-05-12 14:01 [PATCH v2 00/16] platform/x86: Check ACPI_COMPANION() against NULL during probe Rafael J. Wysocki
  2026-05-12 14:03 ` [PATCH v2 01/16] platform/x86: acer-wireless: Check ACPI_COMPANION() against NULL Rafael J. Wysocki
@ 2026-05-12 14:04 ` Rafael J. Wysocki
  2026-05-12 14:05 ` [PATCH v2 03/16] platform/x86: dell/dell-rbtn: " Rafael J. Wysocki
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 14:04 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Corentin Chary, Luke D. Jones,
	Denis Benato, Pali Rohár, Jonathan Woithe, Robert Gerlach,
	Matan Ziv-Av, Kenneth Chan, Mattia Dongili, Jeremy Soller,
	Azael Avalos, Andy Shevchenko, platform-driver-x86

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

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
platform/x86 asus-laptop driver.

Fixes: ba19eb10170b ("platform/x86: asus-laptop: Convert ACPI driver to a platform one")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/platform/x86/asus-laptop.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
index dbbb6292cd11..140ac8a10537 100644
--- a/drivers/platform/x86/asus-laptop.c
+++ b/drivers/platform/x86/asus-laptop.c
@@ -1826,10 +1826,14 @@ static bool asus_device_present;
 
 static int asus_acpi_probe(struct platform_device *pdev)
 {
-	struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
+	struct acpi_device *device;
 	struct asus_laptop *asus;
 	int result;
 
+	device = ACPI_COMPANION(&pdev->dev);
+	if (!device)
+		return -ENODEV;
+
 	pr_notice("Asus Laptop Support version %s\n",
 		  ASUS_LAPTOP_VERSION);
 	asus = kzalloc_obj(struct asus_laptop);
-- 
2.51.0





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

* [PATCH v2 03/16] platform/x86: dell/dell-rbtn: Check ACPI_COMPANION() against NULL
  2026-05-12 14:01 [PATCH v2 00/16] platform/x86: Check ACPI_COMPANION() against NULL during probe Rafael J. Wysocki
  2026-05-12 14:03 ` [PATCH v2 01/16] platform/x86: acer-wireless: Check ACPI_COMPANION() against NULL Rafael J. Wysocki
  2026-05-12 14:04 ` [PATCH v2 02/16] platform/x86: asus-laptop: " Rafael J. Wysocki
@ 2026-05-12 14:05 ` Rafael J. Wysocki
  2026-05-12 14:05 ` [PATCH v2 04/16] platform/x86: eeepc-laptop: " Rafael J. Wysocki
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 14:05 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Corentin Chary, Luke D. Jones,
	Denis Benato, Pali Rohár, Jonathan Woithe, Robert Gerlach,
	Matan Ziv-Av, Kenneth Chan, Mattia Dongili, Jeremy Soller,
	Azael Avalos, Andy Shevchenko, platform-driver-x86

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

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
platform/x86 dell-rbtn driver.

Fixes: 19ebacfb442b ("platform/x86: dell/dell-rbtn: Convert ACPI driver to a platform one")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/platform/x86/dell/dell-rbtn.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/dell/dell-rbtn.c b/drivers/platform/x86/dell/dell-rbtn.c
index 34af9f4ff741..180b8c6720e6 100644
--- a/drivers/platform/x86/dell/dell-rbtn.c
+++ b/drivers/platform/x86/dell/dell-rbtn.c
@@ -396,11 +396,15 @@ static void rbtn_cleanup(struct device *dev)
 
 static int rbtn_probe(struct platform_device *pdev)
 {
-	struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
 	struct rbtn_data *rbtn_data;
+	struct acpi_device *device;
 	enum rbtn_type type;
 	int ret = 0;
 
+	device = ACPI_COMPANION(&pdev->dev);
+	if (!device)
+		return -ENODEV;
+
 	type = rbtn_check(device);
 	if (type == RBTN_UNKNOWN) {
 		dev_info(&pdev->dev, "Unknown device type\n");
-- 
2.51.0





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

* [PATCH v2 04/16] platform/x86: eeepc-laptop: Check ACPI_COMPANION() against NULL
  2026-05-12 14:01 [PATCH v2 00/16] platform/x86: Check ACPI_COMPANION() against NULL during probe Rafael J. Wysocki
                   ` (2 preceding siblings ...)
  2026-05-12 14:05 ` [PATCH v2 03/16] platform/x86: dell/dell-rbtn: " Rafael J. Wysocki
@ 2026-05-12 14:05 ` Rafael J. Wysocki
  2026-05-12 14:08 ` [PATCH v2 05/16] platform/x86: fujitsu: " Rafael J. Wysocki
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 14:05 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Corentin Chary, Luke D. Jones,
	Denis Benato, Pali Rohár, Jonathan Woithe, Robert Gerlach,
	Matan Ziv-Av, Kenneth Chan, Mattia Dongili, Jeremy Soller,
	Azael Avalos, Andy Shevchenko, platform-driver-x86

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

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
platform/x86 eeepc-laptop driver.

Fixes: 079b59fd2d79 ("platform/x86: eeepc-laptop: Convert ACPI driver to a platform one")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/platform/x86/eeepc-laptop.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 02a71095920e..d18a80907611 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -1363,10 +1363,14 @@ static bool eeepc_device_present;
 
 static int eeepc_acpi_probe(struct platform_device *pdev)
 {
-	struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
+	struct acpi_device *device;
 	struct eeepc_laptop *eeepc;
 	int result;
 
+	device = ACPI_COMPANION(&pdev->dev);
+	if (!device)
+		return -ENODEV;
+
 	pr_notice(EEEPC_LAPTOP_NAME "\n");
 	eeepc = kzalloc_obj(struct eeepc_laptop);
 	if (!eeepc)
-- 
2.51.0





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

* [PATCH v2 05/16] platform/x86: fujitsu: Check ACPI_COMPANION() against NULL
  2026-05-12 14:01 [PATCH v2 00/16] platform/x86: Check ACPI_COMPANION() against NULL during probe Rafael J. Wysocki
                   ` (3 preceding siblings ...)
  2026-05-12 14:05 ` [PATCH v2 04/16] platform/x86: eeepc-laptop: " Rafael J. Wysocki
@ 2026-05-12 14:08 ` Rafael J. Wysocki
  2026-05-12 14:09 ` [PATCH v2 06/16] platform/x86: fujitsu-tablet: " Rafael J. Wysocki
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 14:08 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Corentin Chary, Luke D. Jones,
	Denis Benato, Pali Rohár, Jonathan Woithe, Robert Gerlach,
	Matan Ziv-Av, Kenneth Chan, Mattia Dongili, Jeremy Soller,
	Azael Avalos, Andy Shevchenko, platform-driver-x86

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

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 requisite ACPI_COMPANION() checks against NULL to the
platform/x86 fujitsu-laptop driver.

Fixes: 6da22b031a3c ("platform/x86: fujitsu: Convert laptop driver to a platform one")
Fixes: d5c9212ccfaa ("platform/x86: fujitsu: Convert backlight driver to a platform one")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Jonathan Woithe <jwoithe@just42.net>
---
 drivers/platform/x86/fujitsu-laptop.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index 2e265be2267e..54d0b9cec4d3 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -530,10 +530,14 @@ static void acpi_fujitsu_bl_notify(acpi_handle handle, u32 event, void *data)
 
 static int acpi_fujitsu_bl_probe(struct platform_device *pdev)
 {
-	struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
+	struct acpi_device *device;
 	struct fujitsu_bl *priv;
 	int ret;
 
+	device = ACPI_COMPANION(&pdev->dev);
+	if (!device)
+		return -ENODEV;
+
 	if (acpi_video_get_backlight_type() != acpi_backlight_vendor)
 		return -ENODEV;
 
@@ -993,10 +997,14 @@ static void acpi_fujitsu_laptop_notify(acpi_handle handle, u32 event, void *data
 
 static int acpi_fujitsu_laptop_probe(struct platform_device *pdev)
 {
-	struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
 	struct fujitsu_laptop *priv;
+	struct acpi_device *device;
 	int ret, i = 0;
 
+	device = ACPI_COMPANION(&pdev->dev);
+	if (!device)
+		return -ENODEV;
+
 	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
-- 
2.51.0





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

* [PATCH v2 06/16] platform/x86: fujitsu-tablet: Check ACPI_COMPANION() against NULL
  2026-05-12 14:01 [PATCH v2 00/16] platform/x86: Check ACPI_COMPANION() against NULL during probe Rafael J. Wysocki
                   ` (4 preceding siblings ...)
  2026-05-12 14:08 ` [PATCH v2 05/16] platform/x86: fujitsu: " Rafael J. Wysocki
@ 2026-05-12 14:09 ` Rafael J. Wysocki
  2026-05-12 14:11 ` [PATCH v2 07/16] platform/x86: intel/rst: " Rafael J. Wysocki
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 14:09 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Corentin Chary, Luke D. Jones,
	Denis Benato, Pali Rohár, Jonathan Woithe, Robert Gerlach,
	Matan Ziv-Av, Kenneth Chan, Mattia Dongili, Jeremy Soller,
	Azael Avalos, Andy Shevchenko, platform-driver-x86

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

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 requisite ACPI_COMPANION() checks against NULL to the
platform/x86 fujitsu-tablet driver.

Fixes: bd13b265d386 ("platform/x86: fujitsu-tablet: Convert ACPI driver to a platform one")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/platform/x86/fujitsu-tablet.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/fujitsu-tablet.c b/drivers/platform/x86/fujitsu-tablet.c
index 8319df28e9b8..2f8c1b89cbca 100644
--- a/drivers/platform/x86/fujitsu-tablet.c
+++ b/drivers/platform/x86/fujitsu-tablet.c
@@ -445,10 +445,14 @@ static acpi_status fujitsu_walk_resources(struct acpi_resource *res, void *data)
 
 static int acpi_fujitsu_probe(struct platform_device *pdev)
 {
-	struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
+	struct acpi_device *adev;
 	acpi_status status;
 	int error;
 
+	adev = ACPI_COMPANION(&pdev->dev);
+	if (!adev)
+		return -ENODEV;
+
 	status = acpi_walk_resources(adev->handle, METHOD_NAME__CRS,
 			fujitsu_walk_resources, NULL);
 	if (ACPI_FAILURE(status) || !fujitsu.irq || !fujitsu.io_base)
-- 
2.51.0





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

* [PATCH v2 07/16] platform/x86: intel/rst: Check ACPI_COMPANION() against NULL
  2026-05-12 14:01 [PATCH v2 00/16] platform/x86: Check ACPI_COMPANION() against NULL during probe Rafael J. Wysocki
                   ` (5 preceding siblings ...)
  2026-05-12 14:09 ` [PATCH v2 06/16] platform/x86: fujitsu-tablet: " Rafael J. Wysocki
@ 2026-05-12 14:11 ` Rafael J. Wysocki
  2026-05-12 14:11 ` [PATCH v2 08/16] platform/x86: intel/smartconnect: Check ACPI_HANDLE() " Rafael J. Wysocki
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 14:11 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Corentin Chary, Luke D. Jones,
	Denis Benato, Pali Rohár, Jonathan Woithe, Robert Gerlach,
	Matan Ziv-Av, Kenneth Chan, Mattia Dongili, Jeremy Soller,
	Azael Avalos, Andy Shevchenko, platform-driver-x86

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

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
platform/x86 intel/rst driver.

Fixes: 163a68a31f74 ("platform/x86: intel/rst: Convert ACPI driver to a platform one")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/platform/x86/intel/rst.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/intel/rst.c b/drivers/platform/x86/intel/rst.c
index 4bd10927aad9..bb19f0d89305 100644
--- a/drivers/platform/x86/intel/rst.c
+++ b/drivers/platform/x86/intel/rst.c
@@ -102,9 +102,13 @@ static struct device_attribute irst_timeout_attr = {
 
 static int irst_probe(struct platform_device *pdev)
 {
-	struct acpi_device *acpi = ACPI_COMPANION(&pdev->dev);
+	struct acpi_device *acpi;
 	int error;
 
+	acpi = ACPI_COMPANION(&pdev->dev);
+	if (!acpi)
+		return -ENODEV;
+
 	error = device_create_file(&acpi->dev, &irst_timeout_attr);
 	if (unlikely(error))
 		return error;
-- 
2.51.0





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

* [PATCH v2 08/16] platform/x86: intel/smartconnect: Check ACPI_HANDLE() against NULL
  2026-05-12 14:01 [PATCH v2 00/16] platform/x86: Check ACPI_COMPANION() against NULL during probe Rafael J. Wysocki
                   ` (6 preceding siblings ...)
  2026-05-12 14:11 ` [PATCH v2 07/16] platform/x86: intel/rst: " Rafael J. Wysocki
@ 2026-05-12 14:11 ` Rafael J. Wysocki
  2026-05-12 14:12 ` [PATCH v2 09/16] platform/x86: lg-laptop: Check ACPI_COMPANION() " Rafael J. Wysocki
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 14:11 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Corentin Chary, Luke D. Jones,
	Denis Benato, Pali Rohár, Jonathan Woithe, Robert Gerlach,
	Matan Ziv-Av, Kenneth Chan, Mattia Dongili, Jeremy Soller,
	Azael Avalos, Andy Shevchenko, platform-driver-x86

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

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_HANDLE() check against NULL to the
platform/x86 intel/smartconnect driver.

Fixes: 8a44bd3ffdb2 ("platform/x86: intel/smartconnect: Convert ACPI driver to a platform one")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/platform/x86/intel/smartconnect.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/intel/smartconnect.c b/drivers/platform/x86/intel/smartconnect.c
index 4d866b6366d6..71e91ac60e5d 100644
--- a/drivers/platform/x86/intel/smartconnect.c
+++ b/drivers/platform/x86/intel/smartconnect.c
@@ -12,10 +12,14 @@ MODULE_LICENSE("GPL");
 
 static int smartconnect_acpi_probe(struct platform_device *pdev)
 {
-	acpi_handle handle = ACPI_HANDLE(&pdev->dev);
 	unsigned long long value;
+	acpi_handle handle;
 	acpi_status status;
 
+	handle = ACPI_HANDLE(&pdev->dev);
+	if (!handle)
+		return -ENODEV;
+
 	status = acpi_evaluate_integer(handle, "GAOS", NULL, &value);
 	if (ACPI_FAILURE(status))
 		return -EINVAL;
-- 
2.51.0





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

* [PATCH v2 09/16] platform/x86: lg-laptop: Check ACPI_COMPANION() against NULL
  2026-05-12 14:01 [PATCH v2 00/16] platform/x86: Check ACPI_COMPANION() against NULL during probe Rafael J. Wysocki
                   ` (7 preceding siblings ...)
  2026-05-12 14:11 ` [PATCH v2 08/16] platform/x86: intel/smartconnect: Check ACPI_HANDLE() " Rafael J. Wysocki
@ 2026-05-12 14:12 ` Rafael J. Wysocki
  2026-05-12 14:13 ` [PATCH v2 10/16] platform/x86: panasonic-laptop: " Rafael J. Wysocki
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 14:12 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Corentin Chary, Luke D. Jones,
	Denis Benato, Pali Rohár, Jonathan Woithe, Robert Gerlach,
	Matan Ziv-Av, Kenneth Chan, Mattia Dongili, Jeremy Soller,
	Azael Avalos, Andy Shevchenko, platform-driver-x86

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

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
platform/x86 lg-laptop driver.

Fixes: 2d9cb20610f7 ("platform/x86: lg-laptop: Convert ACPI driver to a platform one")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/platform/x86/lg-laptop.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/lg-laptop.c b/drivers/platform/x86/lg-laptop.c
index 9681412d694b..a8f2f465ef3f 100644
--- a/drivers/platform/x86/lg-laptop.c
+++ b/drivers/platform/x86/lg-laptop.c
@@ -761,12 +761,11 @@ static void lg_laptop_remove_address_space_handler(void *data)
 
 static int acpi_probe(struct platform_device *pdev)
 {
-	struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
 	struct platform_device_info pdev_info = {
-		.fwnode = acpi_fwnode_handle(device),
 		.name = PLATFORM_NAME,
 		.id = PLATFORM_DEVID_NONE,
 	};
+	struct acpi_device *device;
 	acpi_status status;
 	int ret;
 	const char *product;
@@ -775,6 +774,12 @@ static int acpi_probe(struct platform_device *pdev)
 	if (pf_device)
 		return 0;
 
+	device = ACPI_COMPANION(&pdev->dev);
+	if (!device)
+		return -ENODEV;
+
+	pdev_info.fwnode = acpi_fwnode_handle(device),
+
 	status = acpi_install_address_space_handler(device->handle, LG_ADDRESS_SPACE_ID,
 						    &lg_laptop_address_space_handler,
 						    NULL, &pdev->dev);
-- 
2.51.0





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

* [PATCH v2 10/16] platform/x86: panasonic-laptop: Check ACPI_COMPANION() against NULL
  2026-05-12 14:01 [PATCH v2 00/16] platform/x86: Check ACPI_COMPANION() against NULL during probe Rafael J. Wysocki
                   ` (8 preceding siblings ...)
  2026-05-12 14:12 ` [PATCH v2 09/16] platform/x86: lg-laptop: Check ACPI_COMPANION() " Rafael J. Wysocki
@ 2026-05-12 14:13 ` Rafael J. Wysocki
  2026-05-12 14:13 ` [PATCH v2 11/16] platform/x86: sony-laptop: " Rafael J. Wysocki
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 14:13 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Corentin Chary, Luke D. Jones,
	Denis Benato, Pali Rohár, Jonathan Woithe, Robert Gerlach,
	Matan Ziv-Av, Kenneth Chan, Mattia Dongili, Jeremy Soller,
	Azael Avalos, Andy Shevchenko, platform-driver-x86

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

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
platform/x86 panasonic-laptop driver.

Fixes: de6837243af0 ("platform/x86: panasonic-laptop: Convert ACPI driver to a platform one")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/platform/x86/panasonic-laptop.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index 1337f7c49805..b83113c26f88 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -981,11 +981,15 @@ static int acpi_pcc_hotkey_resume(struct device *dev)
 
 static int acpi_pcc_hotkey_probe(struct platform_device *pdev)
 {
-	struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
 	struct backlight_properties props;
+	struct acpi_device *device;
 	struct pcc_acpi *pcc;
 	int num_sifr, result;
 
+	device = ACPI_COMPANION(&pdev->dev);
+	if (!device)
+		return -ENODEV;
+
 	num_sifr = acpi_pcc_get_sqty(device);
 
 	/*
-- 
2.51.0





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

* [PATCH v2 11/16] platform/x86: sony-laptop: Check ACPI_COMPANION() against NULL
  2026-05-12 14:01 [PATCH v2 00/16] platform/x86: Check ACPI_COMPANION() against NULL during probe Rafael J. Wysocki
                   ` (9 preceding siblings ...)
  2026-05-12 14:13 ` [PATCH v2 10/16] platform/x86: panasonic-laptop: " Rafael J. Wysocki
@ 2026-05-12 14:13 ` Rafael J. Wysocki
  2026-05-12 14:14 ` [PATCH v2 12/16] platform/x86: system76: " Rafael J. Wysocki
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 14:13 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Corentin Chary, Luke D. Jones,
	Denis Benato, Pali Rohár, Jonathan Woithe, Robert Gerlach,
	Matan Ziv-Av, Kenneth Chan, Mattia Dongili, Jeremy Soller,
	Azael Avalos, Andy Shevchenko, platform-driver-x86

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

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 requisite ACPI_COMPANION() checks against NULL to the
platform/x86 sony-laptop driver.

Fixes: 138db7ee58c0 ("platform/x86: sony-laptop: Convert PIC driver to a platform one")
Fixes: 14004dd31caa ("platform/x86: sony-laptop: Convert NC driver to a platform one")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/platform/x86/sony-laptop.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index b18f00e9082f..67370967df6f 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -3147,11 +3147,15 @@ static void sony_nc_backlight_cleanup(void)
 
 static int sony_nc_probe(struct platform_device *pdev)
 {
-	struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
+	struct acpi_device *device;
 	acpi_status status;
 	int result = 0;
 	struct sony_nc_value *item;
 
+	device = ACPI_COMPANION(&pdev->dev);
+	if (!device)
+		return -ENODEV;
+
 	sony_nc_acpi_device = device;
 	strscpy(acpi_device_class(device), "sony/hotkey");
 
@@ -4509,11 +4513,15 @@ static void sony_pic_remove(struct platform_device *pdev)
 
 static int sony_pic_probe(struct platform_device *pdev)
 {
-	struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
 	struct sony_pic_ioport *io, *tmp_io;
 	struct sony_pic_irq *irq, *tmp_irq;
+	struct acpi_device *device;
 	int result;
 
+	device = ACPI_COMPANION(&pdev->dev);
+	if (!device)
+		return -ENODEV;
+
 	spic_dev.acpi_dev = device;
 	strscpy(acpi_device_class(device), "sony/hotkey");
 	sony_pic_detect_device_type(&spic_dev);
-- 
2.51.0





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

* [PATCH v2 12/16] platform/x86: system76: Check ACPI_COMPANION() against NULL
  2026-05-12 14:01 [PATCH v2 00/16] platform/x86: Check ACPI_COMPANION() against NULL during probe Rafael J. Wysocki
                   ` (10 preceding siblings ...)
  2026-05-12 14:13 ` [PATCH v2 11/16] platform/x86: sony-laptop: " Rafael J. Wysocki
@ 2026-05-12 14:14 ` Rafael J. Wysocki
  2026-05-12 14:15 ` [PATCH v2 13/16] platform/x86: toshiba_acpi: " Rafael J. Wysocki
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 14:14 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Corentin Chary, Luke D. Jones,
	Denis Benato, Pali Rohár, Jonathan Woithe, Robert Gerlach,
	Matan Ziv-Av, Kenneth Chan, Mattia Dongili, Jeremy Soller,
	Azael Avalos, Andy Shevchenko, platform-driver-x86

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

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
platform/x86 system76 driver.

Fixes: 80b8f68b94ab ("platform/x86: system76: Convert ACPI driver to a platform one")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/platform/x86/system76_acpi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/system76_acpi.c b/drivers/platform/x86/system76_acpi.c
index 693cbb461382..dd7b1b07c316 100644
--- a/drivers/platform/x86/system76_acpi.c
+++ b/drivers/platform/x86/system76_acpi.c
@@ -674,10 +674,14 @@ static void system76_notify(acpi_handle handle, u32 event, void *context)
 // Probe a System76 platform device
 static int system76_probe(struct platform_device *pdev)
 {
-	struct acpi_device *acpi_dev = ACPI_COMPANION(&pdev->dev);
+	struct acpi_device *acpi_dev;
 	struct system76_data *data;
 	int err;
 
+	acpi_dev = ACPI_COMPANION(&pdev->dev);
+	if (!acpi_dev)
+		return -ENODEV;
+
 	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
 	if (!data)
 		return -ENOMEM;
-- 
2.51.0





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

* [PATCH v2 13/16] platform/x86: toshiba_acpi: Check ACPI_COMPANION() against NULL
  2026-05-12 14:01 [PATCH v2 00/16] platform/x86: Check ACPI_COMPANION() against NULL during probe Rafael J. Wysocki
                   ` (11 preceding siblings ...)
  2026-05-12 14:14 ` [PATCH v2 12/16] platform/x86: system76: " Rafael J. Wysocki
@ 2026-05-12 14:15 ` Rafael J. Wysocki
  2026-05-12 14:16 ` [PATCH v2 14/16] platform/x86: toshiba_bluetooth: " Rafael J. Wysocki
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 14:15 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Corentin Chary, Luke D. Jones,
	Denis Benato, Pali Rohár, Jonathan Woithe, Robert Gerlach,
	Matan Ziv-Av, Kenneth Chan, Mattia Dongili, Jeremy Soller,
	Azael Avalos, Andy Shevchenko, platform-driver-x86

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

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
platform/x86 toshiba_acpi driver.

Fixes: 246d6cefe525 ("platform/x86: toshiba_acpi: Convert ACPI driver to a platform one")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/platform/x86/toshiba_acpi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 35d899c01740..7cecb3a70b9c 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -3374,7 +3374,7 @@ static const struct dmi_system_id toshiba_dmi_quirks[] __initconst = {
 
 static int toshiba_acpi_probe(struct platform_device *pdev)
 {
-	struct acpi_device *acpi_dev = ACPI_COMPANION(&pdev->dev);
+	struct acpi_device *acpi_dev;
 	struct toshiba_acpi_dev *dev;
 	const char *hci_method;
 	u32 dummy;
@@ -3383,6 +3383,10 @@ static int toshiba_acpi_probe(struct platform_device *pdev)
 	if (toshiba_acpi)
 		return -EBUSY;
 
+	acpi_dev = ACPI_COMPANION(&pdev->dev);
+	if (!acpi_dev)
+		return -ENODEV;
+
 	pr_info("Toshiba Laptop ACPI Extras version %s\n",
 	       TOSHIBA_ACPI_VERSION);
 
-- 
2.51.0





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

* [PATCH v2 14/16] platform/x86: toshiba_bluetooth: Check ACPI_COMPANION() against NULL
  2026-05-12 14:01 [PATCH v2 00/16] platform/x86: Check ACPI_COMPANION() against NULL during probe Rafael J. Wysocki
                   ` (12 preceding siblings ...)
  2026-05-12 14:15 ` [PATCH v2 13/16] platform/x86: toshiba_acpi: " Rafael J. Wysocki
@ 2026-05-12 14:16 ` Rafael J. Wysocki
  2026-05-12 14:17 ` [PATCH v2 15/16] platform/x86: toshiba_haps: " Rafael J. Wysocki
  2026-05-12 14:17 ` [PATCH v2 16/16] platform/x86: wireless-hotkey: " Rafael J. Wysocki
  15 siblings, 0 replies; 17+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 14:16 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Corentin Chary, Luke D. Jones,
	Denis Benato, Pali Rohár, Jonathan Woithe, Robert Gerlach,
	Matan Ziv-Av, Kenneth Chan, Mattia Dongili, Jeremy Soller,
	Azael Avalos, Andy Shevchenko, platform-driver-x86

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

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
platform/x86 toshiba_bluetooth driver.

Fixes: 553b2ac59fbb ("platform/x86: toshiba_bluetooth: Convert ACPI driver to a platform one")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/platform/x86/toshiba_bluetooth.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/toshiba_bluetooth.c b/drivers/platform/x86/toshiba_bluetooth.c
index e50d4fc1e603..e00abba58c7c 100644
--- a/drivers/platform/x86/toshiba_bluetooth.c
+++ b/drivers/platform/x86/toshiba_bluetooth.c
@@ -230,10 +230,14 @@ static int toshiba_bt_resume(struct device *dev)
 
 static int toshiba_bt_rfkill_probe(struct platform_device *pdev)
 {
-	struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
 	struct toshiba_bluetooth_dev *bt_dev;
+	struct acpi_device *device;
 	int result;
 
+	device = ACPI_COMPANION(&pdev->dev);
+	if (!device)
+		return -ENODEV;
+
 	result = toshiba_bluetooth_present(device->handle);
 	if (result)
 		return result;
-- 
2.51.0





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

* [PATCH v2 15/16] platform/x86: toshiba_haps: Check ACPI_COMPANION() against NULL
  2026-05-12 14:01 [PATCH v2 00/16] platform/x86: Check ACPI_COMPANION() against NULL during probe Rafael J. Wysocki
                   ` (13 preceding siblings ...)
  2026-05-12 14:16 ` [PATCH v2 14/16] platform/x86: toshiba_bluetooth: " Rafael J. Wysocki
@ 2026-05-12 14:17 ` Rafael J. Wysocki
  2026-05-12 14:17 ` [PATCH v2 16/16] platform/x86: wireless-hotkey: " Rafael J. Wysocki
  15 siblings, 0 replies; 17+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 14:17 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Corentin Chary, Luke D. Jones,
	Denis Benato, Pali Rohár, Jonathan Woithe, Robert Gerlach,
	Matan Ziv-Av, Kenneth Chan, Mattia Dongili, Jeremy Soller,
	Azael Avalos, Andy Shevchenko, platform-driver-x86

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

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
platform/x86 toshiba_haps driver.

Fixes: 3a96c7915d93 ("platform/x86: toshiba_haps: Convert ACPI driver to a platform one")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/platform/x86/toshiba_haps.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/toshiba_haps.c b/drivers/platform/x86/toshiba_haps.c
index 1486252b5983..8d12241924df 100644
--- a/drivers/platform/x86/toshiba_haps.c
+++ b/drivers/platform/x86/toshiba_haps.c
@@ -182,13 +182,17 @@ static int toshiba_haps_available(acpi_handle handle)
 
 static int toshiba_haps_probe(struct platform_device *pdev)
 {
-	struct acpi_device *acpi_dev = ACPI_COMPANION(&pdev->dev);
 	struct toshiba_haps_dev *haps;
+	struct acpi_device *acpi_dev;
 	int ret;
 
 	if (toshiba_haps)
 		return -EBUSY;
 
+	acpi_dev = ACPI_COMPANION(&pdev->dev);
+	if (!acpi_dev)
+		return -ENODEV;
+
 	if (!toshiba_haps_available(acpi_dev->handle))
 		return -ENODEV;
 
-- 
2.51.0





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

* [PATCH v2 16/16] platform/x86: wireless-hotkey: Check ACPI_COMPANION() against NULL
  2026-05-12 14:01 [PATCH v2 00/16] platform/x86: Check ACPI_COMPANION() against NULL during probe Rafael J. Wysocki
                   ` (14 preceding siblings ...)
  2026-05-12 14:17 ` [PATCH v2 15/16] platform/x86: toshiba_haps: " Rafael J. Wysocki
@ 2026-05-12 14:17 ` Rafael J. Wysocki
  15 siblings, 0 replies; 17+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 14:17 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Corentin Chary, Luke D. Jones,
	Denis Benato, Pali Rohár, Jonathan Woithe, Robert Gerlach,
	Matan Ziv-Av, Kenneth Chan, Mattia Dongili, Jeremy Soller,
	Azael Avalos, Andy Shevchenko, platform-driver-x86

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

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
platform/x86 wireless-hotkey driver.

Fixes: 8507277ef132 ("platform/x86: wireless-hotkey: Convert ACPI driver to a platform one")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/platform/x86/wireless-hotkey.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/wireless-hotkey.c b/drivers/platform/x86/wireless-hotkey.c
index f680d8ff8e87..3151844d1699 100644
--- a/drivers/platform/x86/wireless-hotkey.c
+++ b/drivers/platform/x86/wireless-hotkey.c
@@ -89,9 +89,14 @@ static void wl_notify(acpi_handle handle, u32 event, void *data)
 
 static int wl_probe(struct platform_device *pdev)
 {
+	struct acpi_device *adev;
 	struct wl_button *button;
 	int err;
 
+	adev = ACPI_COMPANION(&pdev->dev);
+	if (!adev)
+		return -ENODEV;
+
 	button = kzalloc_obj(struct wl_button);
 	if (!button)
 		return -ENOMEM;
@@ -104,8 +109,8 @@ static int wl_probe(struct platform_device *pdev)
 		kfree(button);
 		return err;
 	}
-	err = acpi_dev_install_notify_handler(ACPI_COMPANION(&pdev->dev),
-					      ACPI_DEVICE_NOTIFY, wl_notify, button);
+	err = acpi_dev_install_notify_handler(adev, ACPI_DEVICE_NOTIFY,
+					      wl_notify, button);
 	if (err) {
 		pr_err("Failed to install ACPI notify handler\n");
 		wireless_input_destroy(&pdev->dev);
-- 
2.51.0





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

end of thread, other threads:[~2026-05-12 14:19 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-12 14:01 [PATCH v2 00/16] platform/x86: Check ACPI_COMPANION() against NULL during probe Rafael J. Wysocki
2026-05-12 14:03 ` [PATCH v2 01/16] platform/x86: acer-wireless: Check ACPI_COMPANION() against NULL Rafael J. Wysocki
2026-05-12 14:04 ` [PATCH v2 02/16] platform/x86: asus-laptop: " Rafael J. Wysocki
2026-05-12 14:05 ` [PATCH v2 03/16] platform/x86: dell/dell-rbtn: " Rafael J. Wysocki
2026-05-12 14:05 ` [PATCH v2 04/16] platform/x86: eeepc-laptop: " Rafael J. Wysocki
2026-05-12 14:08 ` [PATCH v2 05/16] platform/x86: fujitsu: " Rafael J. Wysocki
2026-05-12 14:09 ` [PATCH v2 06/16] platform/x86: fujitsu-tablet: " Rafael J. Wysocki
2026-05-12 14:11 ` [PATCH v2 07/16] platform/x86: intel/rst: " Rafael J. Wysocki
2026-05-12 14:11 ` [PATCH v2 08/16] platform/x86: intel/smartconnect: Check ACPI_HANDLE() " Rafael J. Wysocki
2026-05-12 14:12 ` [PATCH v2 09/16] platform/x86: lg-laptop: Check ACPI_COMPANION() " Rafael J. Wysocki
2026-05-12 14:13 ` [PATCH v2 10/16] platform/x86: panasonic-laptop: " Rafael J. Wysocki
2026-05-12 14:13 ` [PATCH v2 11/16] platform/x86: sony-laptop: " Rafael J. Wysocki
2026-05-12 14:14 ` [PATCH v2 12/16] platform/x86: system76: " Rafael J. Wysocki
2026-05-12 14:15 ` [PATCH v2 13/16] platform/x86: toshiba_acpi: " Rafael J. Wysocki
2026-05-12 14:16 ` [PATCH v2 14/16] platform/x86: toshiba_bluetooth: " Rafael J. Wysocki
2026-05-12 14:17 ` [PATCH v2 15/16] platform/x86: toshiba_haps: " Rafael J. Wysocki
2026-05-12 14:17 ` [PATCH v2 16/16] platform/x86: wireless-hotkey: " Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox