From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
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: Re: [PATCH v1] platform/x86: Add ACPI_COMPANION() checks against NULL to probe
Date: Tue, 12 May 2026 12:56:31 +0300 (EEST) [thread overview]
Message-ID: <a944a591-409d-6a73-3c6f-5c29bb2583f9@linux.intel.com> (raw)
In-Reply-To: <4731840.LvFx2qVVIh@rafael.j.wysocki>
On Mon, 11 May 2026, Rafael J. Wysocki wrote:
> 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() or ACPI_HANDLE() checks
> against NULL to multiple platform/x86 drivers where they are missing.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Don't these fixes need fixes tags?
So this part has the changes that are needed pre-7.1?
And the other is for changes going into 7.1?
> ---
> drivers/platform/x86/adv_swbutton.c | 6 +++++-
> drivers/platform/x86/hp/hp_accel.c | 3 +++
> drivers/platform/x86/intel/hid.c | 6 +++++-
> drivers/platform/x86/intel/int1092/intel_sar.c | 7 ++++++-
> drivers/platform/x86/intel/vbtn.c | 6 +++++-
> 5 files changed, 24 insertions(+), 4 deletions(-)
>
> --- 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;
> --- 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;
> --- 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)) {
> --- 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);
> --- 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);
>
>
>
--
i.
next prev parent reply other threads:[~2026-05-12 9:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-11 19:52 [PATCH v1] platform/x86: Add ACPI_COMPANION() checks against NULL to probe Rafael J. Wysocki
2026-05-12 9:56 ` Ilpo Järvinen [this message]
2026-05-12 10:24 ` Rafael J. Wysocki
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=a944a591-409d-6a73-3c6f-5c29bb2583f9@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--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=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rafael@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