Linux ACPI
 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>,
	"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>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	platform-driver-x86@vger.kernel.org
Subject: [PATCH v2 10/16] platform/x86: panasonic-laptop: Check ACPI_COMPANION() against NULL
Date: Tue, 12 May 2026 16:13:13 +0200	[thread overview]
Message-ID: <3353471.5fSG56mABF@rafael.j.wysocki> (raw)
In-Reply-To: <12904885.O9o76ZdvQC@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 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





  parent reply	other threads:[~2026-05-12 14:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Rafael J. Wysocki [this message]
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

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=3353471.5fSG56mABF@rafael.j.wysocki \
    --to=rafael@kernel.org \
    --cc=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 \
    /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