The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Hans de Goede <hansg@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux ACPI <linux-acpi@vger.kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	platform-driver-x86@vger.kernel.org,
	Andrea Ho <Andrea.Ho@advantech.com.tw>,
	Eric Piel <eric.piel@tremplin-utc.net>,
	Alex Hung <alexhung@gmail.com>,
	Shravan Sudhakar <s.shravan@intel.com>,
	AceLan Kao <acelan.kao@canonical.com>
Subject: [PATCH v2 2/5] platform/x86: hp_accel: Check ACPI_COMPANION() against NULL
Date: Tue, 12 May 2026 17:12:40 +0200	[thread overview]
Message-ID: <2425918.ElGaqSPkdT@rafael.j.wysocki> (raw)
In-Reply-To: <6007701.DvuYhMxLoT@rafael.j.wysocki>

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;




  parent reply	other threads:[~2026-05-12 15:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2026-05-12 15:13 ` [PATCH v2 3/5] platform/x86: intel-hid: " 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

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=2425918.ElGaqSPkdT@rafael.j.wysocki \
    --to=rafael@kernel.org \
    --cc=Andrea.Ho@advantech.com.tw \
    --cc=acelan.kao@canonical.com \
    --cc=alexhung@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=eric.piel@tremplin-utc.net \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=s.shravan@intel.com \
    /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