platform/x86: Check ACPI_COMPANION() or ACPI_HANDLE() against NULL
Subsystems (7)
Rafael J. Wysocki
maintainerv2 cover platform/x86: Check ACPI_COMPANION() or ACPI_HANDLE() against NULL
Hi All,
This series replaces
https://lore.kernel.org/linux-acpi/[email protected]/
and as a whole it makes exactly the same code changes.
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 5 platform/x86 drivers where they are missing.
Thanks!
Rafael J. Wysocki
maintainerPATCH v2 1/5 platform/x86: adv_swbutton: Check ACPI_HANDLE() against NULL
From: "Rafael J. Wysocki" <[email protected]>
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_HANDLE() check against NULL to the platform/x86 adv_swbutton driver.
--- drivers/platform/x86/adv_swbutton.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/platform/x86/adv_swbutton.c +5 -1
@@ -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 ;
Rafael J. Wysocki
maintainerPATCH v2 2/5 platform/x86: hp_accel: Check ACPI_COMPANION() against NULL
In reply to Rafael J. WysockiFrom: "Rafael J. Wysocki" <[email protected]>
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.
--- drivers/platform/x86/hp/hp_accel.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/platform/x86/hp/hp_accel.c +3 -0
@@ -300,6 +300,9 @@ static int lis3lv02d_probe(struct platfoint 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;
Rafael J. Wysocki
maintainerPATCH v2 3/5 platform/x86: intel-hid: Check ACPI_HANDLE() against NULL
In reply to Rafael J. WysockiFrom: "Rafael J. Wysocki" <[email protected]>
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_HANDLE() check against NULL to the platform/x86 intel-hid driver.
--- drivers/platform/x86/intel/hid.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/platform/x86/intel/hid.c +5 -1
@@ -688,12 +688,16 @@ static bool button_array_present(structstatic 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)) {
Rafael J. Wysocki
maintainerPATCH v2 4/5 platform/x86: intel_sar: Check ACPI_HANDLE() against NULL
In reply to Rafael J. WysockiFrom: "Rafael J. Wysocki" <[email protected]>
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_HANDLE() check against NULL to the platform/x86 intel_sar driver.
--- drivers/platform/x86/intel/int1092/intel_sar.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/platform/x86/intel/int1092/intel_sar.c +6 -1
@@ -245,15 +245,20 @@ static void sar_get_data(int reg, structstatic 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);
Rafael J. Wysocki
maintainerPATCH v2 5/5 platform/x86: intel-vbtn: Check ACPI_HANDLE() against NULL
In reply to Rafael J. WysockiFrom: "Rafael J. Wysocki" <[email protected]>
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_HANDLE() check against NULL to the platform/x86 intel-vbtn driver.
--- drivers/platform/x86/intel/vbtn.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/platform/x86/intel/vbtn.c +5 -1
@@ -275,12 +275,16 @@ static bool intel_vbtn_has_switches(acpistatic 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);
Quoted 8 lines · Rafael J. Wysocki
Hi All,
This series replaces
https://lore.kernel.org/linux-acpi/[email protected]/
and as a whole it makes exactly the same code changes.
Quoted 7 lines
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()orACPI_HANDLE()checks against NULL to 5 platform/x86 drivers where they are missing.
to the whole series.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Rafael J. Wysocki
maintainerHi Ilpo,
Quoted 14 lines · Rafael J. Wysocki
Hi All,
This series replaces
https://lore.kernel.org/linux-acpi/[email protected]/
and as a whole it makes exactly the same code changes.
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.
Quoted 4 lines
Accordingly, add requisite
ACPI_COMPANION()orACPI_HANDLE()checks against NULL to 5 platform/x86 drivers where they are missing.Thanks!
I've noticed that you've picked up all of my patches except for this series.
Has it been deferred on purpose or has it fallen through cracks?
Ilpo Järvinen
maintainerQuoted 17 lines · Rafael J. Wysocki
Hi Ilpo,
Quoted 14 lines · Rafael J. Wysocki
Hi All,
This series replaces
https://lore.kernel.org/linux-acpi/[email protected]/
and as a whole it makes exactly the same code changes.
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.
Quoted 8 lines
Quoted 4 lines
Accordingly, add requisite
ACPI_COMPANION()orACPI_HANDLE()checks against NULL to 5 platform/x86 drivers where they are missing.Thanks!
I've noticed that you've picked up all of my patches except for this series.
Has it been deferred on purpose or has it fallen through cracks?
Somebody is a bit impatient... ;-) Nothing has fallen through the cracks, I just cannot apply patches infinitely fast because I also do take time to review them while applying... :-)
~/linux/platform-fixes$ b4 ty -l 2>&1 | grep -B1 'Rafael'
3: [PATCH v2 0/5] platform/x86: Check ACPI_COMPANION() or ACPI_HANDLE() against NULL
From: Rafael J. Wysocki <[email protected]>
--
4: [PATCH v1] platform/surface: surfacepro3_button: Check ACPI_COMPANION()
From: Rafael J. Wysocki <[email protected]>
Signature · 1 line
i.
Rafael J. Wysocki
maintainerQuoted 25 lines · Ilpo Järvinen
Quoted 22 lines · Rafael J. Wysocki
Hi Ilpo,
Quoted 18 lines · Rafael J. Wysocki
Hi All,
This series replaces
https://lore.kernel.org/linux-acpi/[email protected]/
and as a whole it makes exactly the same code changes.
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()orACPI_HANDLE()checks against NULL to 5 platform/x86 drivers where they are missing.Thanks!
Quoted 7 lines
Quoted 3 lines
I've noticed that you've picked up all of my patches except for this series.
Has it been deferred on purpose or has it fallen through cracks?
Somebody is a bit impatient... ;-) Nothing has fallen through the cracks, I just cannot apply patches infinitely fast because I also do take time to review them while applying... :-)
Oh, sorry, I should have waited a bit longer, but it is similar to one of the other series, so I wasn't quite sure what happened.
Quoted 8 lines
~/linux/platform-fixes$ b4 ty -l 2>&1 | grep -B1 'Rafael'
3: [PATCH v2 0/5] platform/x86: CheckACPI_COMPANION()orACPI_HANDLE()against NULL
From: Rafael J. Wysocki <[email protected]>
--
4: [PATCH v1] platform/surface:surfacepro3_button: CheckACPI_COMPANION()
From: Rafael J. Wysocki <[email protected]>--
Ilpo Järvinen
maintainerQuoted 4 lines · Rafael J. Wysocki
This series replaces
Quoted 8 lines
and as a whole it makes exactly the same code changes.
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.[...]
Thank you for your contribution, it has been applied to my local review-ilpo-fixes branch. Note it will show up in the public platform-drivers-x86/review-ilpo-fixes branch only once I've pushed my local branch there, which might take a while.
The list of commits applied:
[1/5] platform/x86: adv_swbutton: Check ACPI_HANDLE() against NULL
commit: e7a9a6ea40e352cd7977f6a8c80bdeadf65ad838
[2/5] platform/x86: hp_accel: Check ACPI_COMPANION() against NULL
commit: abfbe5ee8ae89f1f5449790423d5dd3e423545bd
[3/5] platform/x86: intel-hid: Check ACPI_HANDLE() against NULL
commit: 5c69e090ae5dd93d910f70db0796357080707d26
[4/5] platform/x86: intel_sar: Check ACPI_HANDLE() against NULL
commit: 2765f16c12af7c2533763e46b8113b727354012d
[5/5] platform/x86: intel-vbtn: Check ACPI_HANDLE() against NULL
commit: a9f305c5a355efeb240d406d378491d9eec02d07--
i.