From: Rafael J. Wysocki Date: Fri, 20 Mar 2026 10:33:03 +0000 (+0100) Subject: platform/x86: panasonic-laptop: Remove redundant checks from 3 functions X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a347e11252c60bfce1bf15f2f86484cdb9bf6468;p=thirdparty%2Fkernel%2Fstable.git platform/x86: panasonic-laptop: Remove redundant checks from 3 functions The device pointer cannot be NULL in acpi_pcc_hotkey_add() and acpi_pcc_hotkey_remove() because these functions are ACPI driver callbacks and NULL is never passed to any of them as an argument. Likewise, acpi_pcc_hotkey_resume() is a resume callback of a device driver and NULL is never passed to it as an argument, so the dev pointer in it cannot be NULL. Moreover, since acpi_pcc_hotkey_remove() and acpi_pcc_hotkey_resume() can only run after acpi_pcc_hotkey_add() has completed successfully, the acpi_driver_data() of the device object used by them cannot be NULL when they run. Drop all of the redundant NULL checks of the pointers mentioned above. Signed-off-by: Rafael J. Wysocki Link: https://patch.msgid.link/1957824.tdWV9SEqCh@rafael.j.wysocki Reviewed-by: Ilpo Järvinen Signed-off-by: Ilpo Järvinen --- diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c index 56b4e61d7e5c..188ec597a14e 100644 --- a/drivers/platform/x86/panasonic-laptop.c +++ b/drivers/platform/x86/panasonic-laptop.c @@ -965,14 +965,7 @@ static int acpi_pcc_init_input(struct pcc_acpi *pcc) #ifdef CONFIG_PM_SLEEP static int acpi_pcc_hotkey_resume(struct device *dev) { - struct pcc_acpi *pcc; - - if (!dev) - return -EINVAL; - - pcc = acpi_driver_data(to_acpi_device(dev)); - if (!pcc) - return -EINVAL; + struct pcc_acpi *pcc = acpi_driver_data(to_acpi_device(dev)); if (pcc->num_sifr > SINF_MUTE) acpi_pcc_write_sset(pcc, SINF_MUTE, pcc->mute); @@ -994,9 +987,6 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) struct pcc_acpi *pcc; int num_sifr, result; - if (!device) - return -EINVAL; - num_sifr = acpi_pcc_get_sqty(device); /* @@ -1121,9 +1111,6 @@ static void acpi_pcc_hotkey_remove(struct acpi_device *device) { struct pcc_acpi *pcc = acpi_driver_data(device); - if (!device || !pcc) - return; - i8042_remove_filter(panasonic_i8042_filter); if (pcc->platform) {