The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v2 0/5] platform/x86: Check ACPI_COMPANION() or ACPI_HANDLE() against NULL
@ 2026-05-12 15:10 Rafael J. Wysocki
  2026-05-12 15:11 ` [PATCH v2 1/5] platform/x86: adv_swbutton: Check " Rafael J. Wysocki
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 15:10 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Andy Shevchenko,
	platform-driver-x86, Andrea Ho, Eric Piel, Alex Hung,
	Shravan Sudhakar, AceLan Kao

Hi All,

This series replaces

https://lore.kernel.org/linux-acpi/4731840.LvFx2qVVIh@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, add requisite ACPI_COMPANION() or ACPI_HANDLE() checks
against NULL to 5 platform/x86 drivers where they are missing.

Thanks!




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

* [PATCH v2 1/5] platform/x86: adv_swbutton: Check ACPI_HANDLE() against NULL
  2026-05-12 15:10 [PATCH v2 0/5] platform/x86: Check ACPI_COMPANION() or ACPI_HANDLE() against NULL Rafael J. Wysocki
@ 2026-05-12 15:11 ` Rafael J. Wysocki
  2026-05-12 15:12 ` [PATCH v2 2/5] platform/x86: hp_accel: Check ACPI_COMPANION() " Rafael J. Wysocki
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 15:11 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Andy Shevchenko,
	platform-driver-x86, Andrea Ho, Eric Piel, Alex Hung,
	Shravan Sudhakar, AceLan Kao

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 adv_swbutton driver.

Fixes: 3d904005f686 ("platform/x86: add support for Advantech software defined button")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/platform/x86/adv_swbutton.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/drivers/platform/x86/adv_swbutton.c
+++ b/drivers/platform/x86/adv_swbutton.c
@@ -48,10 +48,14 @@ static int adv_swbutton_probe(struct pla
 {
 	struct adv_swbutton *button;
 	struct input_dev *input;
-	acpi_handle handle = ACPI_HANDLE(&device->dev);
+	acpi_handle handle;
 	acpi_status status;
 	int error;
 
+	handle = ACPI_HANDLE(&device->dev);
+	if (!handle)
+		return -ENODEV;
+
 	button = devm_kzalloc(&device->dev, sizeof(*button), GFP_KERNEL);
 	if (!button)
 		return -ENOMEM;




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

* [PATCH v2 2/5] platform/x86: hp_accel: Check ACPI_COMPANION() against NULL
  2026-05-12 15:10 [PATCH v2 0/5] platform/x86: Check ACPI_COMPANION() or ACPI_HANDLE() against NULL Rafael J. Wysocki
  2026-05-12 15:11 ` [PATCH v2 1/5] platform/x86: adv_swbutton: Check " Rafael J. Wysocki
@ 2026-05-12 15:12 ` Rafael J. Wysocki
  2026-05-12 15:13 ` [PATCH v2 3/5] platform/x86: intel-hid: Check ACPI_HANDLE() " Rafael J. Wysocki
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 15:12 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Andy Shevchenko,
	platform-driver-x86, Andrea Ho, Eric Piel, Alex Hung,
	Shravan Sudhakar, AceLan Kao

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 hp_accel driver.

Fixes: 8ebcb6c94c71 ("platform/x86: hp_accel: Convert to be a platform driver")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/platform/x86/hp/hp_accel.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/platform/x86/hp/hp_accel.c
+++ b/drivers/platform/x86/hp/hp_accel.c
@@ -300,6 +300,9 @@ static int lis3lv02d_probe(struct platfo
 	int ret;
 
 	lis3_dev.bus_priv = ACPI_COMPANION(&device->dev);
+	if (!lis3_dev.bus_priv)
+		return -ENODEV;
+
 	lis3_dev.init = lis3lv02d_acpi_init;
 	lis3_dev.read = lis3lv02d_acpi_read;
 	lis3_dev.write = lis3lv02d_acpi_write;




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

* [PATCH v2 3/5] platform/x86: intel-hid: Check ACPI_HANDLE() against NULL
  2026-05-12 15:10 [PATCH v2 0/5] platform/x86: Check ACPI_COMPANION() or ACPI_HANDLE() against NULL Rafael J. Wysocki
  2026-05-12 15:11 ` [PATCH v2 1/5] platform/x86: adv_swbutton: Check " Rafael J. Wysocki
  2026-05-12 15:12 ` [PATCH v2 2/5] platform/x86: hp_accel: Check ACPI_COMPANION() " Rafael J. Wysocki
@ 2026-05-12 15:13 ` Rafael J. Wysocki
  2026-05-12 15:15 ` [PATCH v2 4/5] platform/x86: intel_sar: " Rafael J. Wysocki
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 15:13 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Andy Shevchenko,
	platform-driver-x86, Andrea Ho, Eric Piel, Alex Hung,
	Shravan Sudhakar, AceLan Kao

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-hid driver.

Fixes: ecc83e52b28c ("intel-hid: new hid event driver for hotkeys")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/platform/x86/intel/hid.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/drivers/platform/x86/intel/hid.c
+++ b/drivers/platform/x86/intel/hid.c
@@ -688,12 +688,16 @@ static bool button_array_present(struct
 
 static int intel_hid_probe(struct platform_device *device)
 {
-	acpi_handle handle = ACPI_HANDLE(&device->dev);
 	unsigned long long mode, dummy;
 	struct intel_hid_priv *priv;
+	acpi_handle handle;
 	acpi_status status;
 	int err;
 
+	handle = ACPI_HANDLE(&device->dev);
+	if (!handle)
+		return -ENODEV;
+
 	intel_hid_init_dsm(handle);
 
 	if (!intel_hid_evaluate_method(handle, INTEL_HID_DSM_HDMM_FN, &mode)) {




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

* [PATCH v2 4/5] platform/x86: intel_sar: Check ACPI_HANDLE() against NULL
  2026-05-12 15:10 [PATCH v2 0/5] platform/x86: Check ACPI_COMPANION() or ACPI_HANDLE() against NULL Rafael J. Wysocki
                   ` (2 preceding siblings ...)
  2026-05-12 15:13 ` [PATCH v2 3/5] platform/x86: intel-hid: Check ACPI_HANDLE() " Rafael J. Wysocki
@ 2026-05-12 15:15 ` Rafael J. Wysocki
  2026-05-12 15:16 ` [PATCH v2 5/5] platform/x86: intel-vbtn: " Rafael J. Wysocki
  2026-05-12 17:59 ` [PATCH v2 0/5] platform/x86: Check ACPI_COMPANION() or " Andy Shevchenko
  5 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 15:15 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Andy Shevchenko,
	platform-driver-x86, Andrea Ho, Eric Piel, Alex Hung,
	Shravan Sudhakar, AceLan Kao

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_sar driver.

Fixes: dcfbd31ef4bc ("platform/x86: BIOS SAR driver for Intel M.2 Modem")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/platform/x86/intel/int1092/intel_sar.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/drivers/platform/x86/intel/int1092/intel_sar.c
+++ b/drivers/platform/x86/intel/int1092/intel_sar.c
@@ -245,15 +245,20 @@ static void sar_get_data(int reg, struct
 static int sar_probe(struct platform_device *device)
 {
 	struct wwan_sar_context *context;
+	acpi_handle handle;
 	int reg;
 	int result;
 
+	handle = ACPI_HANDLE(&device->dev);
+	if (!handle)
+		return -ENODEV;
+
 	context = kzalloc_obj(*context);
 	if (!context)
 		return -ENOMEM;
 
 	context->sar_device = device;
-	context->handle = ACPI_HANDLE(&device->dev);
+	context->handle = handle;
 	dev_set_drvdata(&device->dev, context);
 
 	result = guid_parse(SAR_DSM_UUID, &context->guid);




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

* [PATCH v2 5/5] platform/x86: intel-vbtn: Check ACPI_HANDLE() against NULL
  2026-05-12 15:10 [PATCH v2 0/5] platform/x86: Check ACPI_COMPANION() or ACPI_HANDLE() against NULL Rafael J. Wysocki
                   ` (3 preceding siblings ...)
  2026-05-12 15:15 ` [PATCH v2 4/5] platform/x86: intel_sar: " Rafael J. Wysocki
@ 2026-05-12 15:16 ` Rafael J. Wysocki
  2026-05-12 17:59 ` [PATCH v2 0/5] platform/x86: Check ACPI_COMPANION() or " Andy Shevchenko
  5 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 15:16 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, Andy Shevchenko,
	platform-driver-x86, Andrea Ho, Eric Piel, Alex Hung,
	Shravan Sudhakar, AceLan Kao

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-vbtn driver.

Fixes: 26173179fae1 ("platform/x86: intel-vbtn: Eval VBDL after registering our notifier")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/platform/x86/intel/vbtn.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/drivers/platform/x86/intel/vbtn.c
+++ b/drivers/platform/x86/intel/vbtn.c
@@ -275,12 +275,16 @@ static bool intel_vbtn_has_switches(acpi
 
 static int intel_vbtn_probe(struct platform_device *device)
 {
-	acpi_handle handle = ACPI_HANDLE(&device->dev);
 	bool dual_accel, has_buttons, has_switches;
 	struct intel_vbtn_priv *priv;
+	acpi_handle handle;
 	acpi_status status;
 	int err;
 
+	handle = ACPI_HANDLE(&device->dev);
+	if (!handle)
+		return -ENODEV;
+
 	dual_accel = dual_accel_detect();
 	has_buttons = acpi_has_method(handle, "VBDL");
 	has_switches = intel_vbtn_has_switches(handle, dual_accel);




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

* Re: [PATCH v2 0/5] platform/x86: Check ACPI_COMPANION() or ACPI_HANDLE() against NULL
  2026-05-12 15:10 [PATCH v2 0/5] platform/x86: Check ACPI_COMPANION() or ACPI_HANDLE() against NULL Rafael J. Wysocki
                   ` (4 preceding siblings ...)
  2026-05-12 15:16 ` [PATCH v2 5/5] platform/x86: intel-vbtn: " Rafael J. Wysocki
@ 2026-05-12 17:59 ` Andy Shevchenko
  5 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2026-05-12 17:59 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Ilpo Järvinen, Hans de Goede, LKML, Linux ACPI,
	platform-driver-x86, Andrea Ho, Eric Piel, Alex Hung,
	Shravan Sudhakar, AceLan Kao

On Tue, May 12, 2026 at 05:10:35PM +0200, Rafael J. Wysocki wrote:
> Hi All,
> 
> This series replaces
> 
> https://lore.kernel.org/linux-acpi/4731840.LvFx2qVVIh@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, add requisite ACPI_COMPANION() or ACPI_HANDLE() checks
> against NULL to 5 platform/x86 drivers where they are missing.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

to the whole series.

-- 
With Best Regards,
Andy Shevchenko



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

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

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-12 15:10 [PATCH v2 0/5] platform/x86: Check ACPI_COMPANION() or ACPI_HANDLE() against NULL Rafael J. Wysocki
2026-05-12 15:11 ` [PATCH v2 1/5] platform/x86: adv_swbutton: Check " Rafael J. Wysocki
2026-05-12 15:12 ` [PATCH v2 2/5] platform/x86: hp_accel: Check ACPI_COMPANION() " Rafael J. Wysocki
2026-05-12 15:13 ` [PATCH v2 3/5] platform/x86: intel-hid: Check ACPI_HANDLE() " Rafael J. Wysocki
2026-05-12 15:15 ` [PATCH v2 4/5] platform/x86: intel_sar: " Rafael J. Wysocki
2026-05-12 15:16 ` [PATCH v2 5/5] platform/x86: intel-vbtn: " Rafael J. Wysocki
2026-05-12 17:59 ` [PATCH v2 0/5] platform/x86: Check ACPI_COMPANION() or " Andy Shevchenko

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