Skip to content

Commit 33297ce

Browse files
jwrdegoedeij-intel
authored andcommitted
platform/x86: panasonic-laptop: Allocate 1 entry extra in the sinf array
Some DSDT-s have an off-by-one bug where the SINF package count is one higher than the SQTY reported value, allocate 1 entry extra. Also make the SQTY <-> SINF package count mismatch error more verbose to help debugging similar issues in the future. This fixes the panasonic-laptop driver failing to probe() on some devices with the following errors: [ 3.958887] SQTY reports bad SINF length SQTY: 37 SINF-pkg-count: 38 [ 3.958892] Couldn't retrieve BIOS data [ 3.983685] Panasonic Laptop Support - With Macros: probe of MAT0019:00 failed with error -5 Fixes: 709ee53 ("panasonic-laptop: add Panasonic Let's Note laptop extras driver v0.94") Cc: [email protected] Tested-by: James Harmison <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]>
1 parent f52e98d commit 33297ce

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/platform/x86/panasonic-laptop.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,8 @@ static int acpi_pcc_retrieve_biosdata(struct pcc_acpi *pcc)
337337
}
338338

339339
if (pcc->num_sifr < hkey->package.count) {
340-
pr_err("SQTY reports bad SINF length\n");
340+
pr_err("SQTY reports bad SINF length SQTY: %lu SINF-pkg-count: %u\n",
341+
pcc->num_sifr, hkey->package.count);
341342
status = AE_ERROR;
342343
goto end;
343344
}
@@ -994,6 +995,12 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
994995
return -ENODEV;
995996
}
996997

998+
/*
999+
* Some DSDT-s have an off-by-one bug where the SINF package count is
1000+
* one higher than the SQTY reported value, allocate 1 entry extra.
1001+
*/
1002+
num_sifr++;
1003+
9971004
pcc = kzalloc(sizeof(struct pcc_acpi), GFP_KERNEL);
9981005
if (!pcc) {
9991006
pr_err("Couldn't allocate mem for pcc");

0 commit comments

Comments
 (0)