The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Hans de Goede" <hansg@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"Linux ACPI" <linux-acpi@vger.kernel.org>,
	"Corentin Chary" <corentin.chary@gmail.com>,
	"Luke D. Jones" <luke@ljones.dev>,
	"Denis Benato" <denis.benato@linux.dev>,
	"Pali Rohár" <pali@kernel.org>,
	"Jonathan Woithe" <jwoithe@just42.net>,
	"Robert Gerlach" <khnz@gmx.de>,
	"Matan Ziv-Av" <matan@svgalib.org>,
	"Kenneth Chan" <kenneth.t.chan@gmail.com>,
	"Mattia Dongili" <malattia@linux.it>,
	"Jeremy Soller" <jeremy@system76.com>,
	"Azael Avalos" <coproscefalo@gmail.com>,
	platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH v1] platform/x86: Check ACPI_COMPANION() against NULL during probe
Date: Tue, 12 May 2026 10:25:25 +0300	[thread overview]
Message-ID: <agLV5STILBnNNfWH@ashevche-desk.local> (raw)
In-Reply-To: <5990022.DvuYhMxLoT@rafael.j.wysocki>

On Mon, May 11, 2026 at 09:48:26PM +0200, Rafael J. Wysocki wrote:

> 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 that have been converted
> to platform drivers from ACPI drivers recently.

> Fixes: 578bc2a53ae2 ("platform/wmi: Convert drivers to use wmidev_invoke_procedure()")
> Fixes: f7e648027d7e ("platform/x86: asus-wireless: Convert ACPI driver to a platform one")
> Fixes: ba19eb10170b ("platform/x86: asus-laptop: Convert ACPI driver to a platform one")
> Fixes: 3a96c7915d93 ("platform/x86: toshiba_haps: Convert ACPI driver to a platform one")
> Fixes: 553b2ac59fbb ("platform/x86: toshiba_bluetooth: Convert ACPI driver to a platform one")
> Fixes: 246d6cefe525 ("platform/x86: toshiba_acpi: Convert ACPI driver to a platform one")
> Fixes: 19ebacfb442b ("platform/x86: dell/dell-rbtn: Convert ACPI driver to a platform one")
> Fixes: 80b8f68b94ab ("platform/x86: system76: Convert ACPI driver to a platform one")
> Fixes: de6837243af0 ("platform/x86: panasonic-laptop: Convert ACPI driver to a platform one")
> Fixes: 6da22b031a3c ("platform/x86: fujitsu: Convert laptop driver to a platform one")
> Fixes: d5c9212ccfaa ("platform/x86: fujitsu: Convert backlight driver to a platform one")
> Fixes: bd13b265d386 ("platform/x86: fujitsu-tablet: Convert ACPI driver to a platform one")
> Fixes: 8507277ef132 ("platform/x86: wireless-hotkey: Convert ACPI driver to a platform one")
> Fixes: 3471415c8186 ("platform/x86: topstar-laptop: Convert ACPI driver to a platform one")
> 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")
> Fixes: 2d9cb20610f7 ("platform/x86: lg-laptop: Convert ACPI driver to a platform one")
> Fixes: 8a44bd3ffdb2 ("platform/x86: intel/smartconnect: Convert ACPI driver to a platform one")
> Fixes: 163a68a31f74 ("platform/x86: intel/rst: Convert ACPI driver to a platform one")
> Fixes: 079b59fd2d79 ("platform/x86: eeepc-laptop: Convert ACPI driver to a platform one")
> Fixes: b30a462720ad ("platform/x86: acer-wireless: Convert ACPI driver to a platform one")

Looking at this I would rather see the series, but am not a maintainer here and
I'm fine with the result. As a single patch or as a series

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

...

>  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,

Don't you want ACPI_HANDLE() actually? (Note it's not directly related
to this change, but perhaps a material for further improvements.)

>  			fujitsu_walk_resources, NULL);

...

> +	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,

Similar Q here. And some more drivers seem use handle in the given context.

>  						    &lg_laptop_address_space_handler,
>  						    NULL, &pdev->dev);

-- 
With Best Regards,
Andy Shevchenko



  parent reply	other threads:[~2026-05-12  7:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11 19:48 [PATCH v1] platform/x86: Check ACPI_COMPANION() against NULL during probe Rafael J. Wysocki
2026-05-12  0:16 ` Jonathan Woithe
2026-05-12  7:25 ` Andy Shevchenko [this message]
2026-05-12  9:50   ` Rafael J. Wysocki
2026-05-12  9:53   ` Ilpo Järvinen
2026-05-12 10:31     ` 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=agLV5STILBnNNfWH@ashevche-desk.local \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=coproscefalo@gmail.com \
    --cc=corentin.chary@gmail.com \
    --cc=denis.benato@linux.dev \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jeremy@system76.com \
    --cc=jwoithe@just42.net \
    --cc=kenneth.t.chan@gmail.com \
    --cc=khnz@gmx.de \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luke@ljones.dev \
    --cc=malattia@linux.it \
    --cc=matan@svgalib.org \
    --cc=pali@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael@kernel.org \
    /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