Skip to content

Commit 6f89d96

Browse files
rafaeljwdtor
authored andcommitted
Input: atlas - check ACPI_COMPANION() against NULL
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 atlas_btns driver. Fixes: b830388 ("Input: atlas - convert ACPI driver to a platform one") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/8696590.T7Z3S40VBb@rafael.j.wysocki Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent a5fd88a commit 6f89d96

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/input/misc/atlas_btns.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,15 @@ static acpi_status acpi_atlas_button_handler(u32 function,
6060

6161
static int atlas_acpi_button_probe(struct platform_device *pdev)
6262
{
63-
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
63+
struct acpi_device *device;
6464
acpi_status status;
6565
int i;
6666
int err;
6767

68+
device = ACPI_COMPANION(&pdev->dev);
69+
if (!device)
70+
return -ENODEV;
71+
6872
input_dev = input_allocate_device();
6973
if (!input_dev) {
7074
pr_err("unable to allocate input device\n");

0 commit comments

Comments
 (0)