X86 platform drivers
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Andy Shevchenko <andy@kernel.org>,
	James Harmison <jharmison@redhat.com>,
	 platform-driver-x86@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 2/3] platform/x86: panasonic-laptop: Allocate 1 entry extra in the sinf array
Date: Tue, 3 Sep 2024 13:33:23 +0300 (EEST)	[thread overview]
Message-ID: <a22f5196-7fa4-6fc4-7354-3fcf8e99c2d8@linux.intel.com> (raw)
In-Reply-To: <20240903083533.9403-2-hdegoede@redhat.com>

On Tue, 3 Sep 2024, Hans de Goede wrote:

> Some DSDT-s have an of by one bug where the SINF package count is

of -> off

> one higher then 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: 709ee531c153 ("panasonic-laptop: add Panasonic Let's Note laptop extras driver v0.94")
> Cc: stable@vger.kernel.org
> Tested-by: James Harmison <jharmison@redhat.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/platform/x86/panasonic-laptop.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
> index d7f9017a5a13..4c9e20e1afe8 100644
> --- a/drivers/platform/x86/panasonic-laptop.c
> +++ b/drivers/platform/x86/panasonic-laptop.c
> @@ -337,7 +337,8 @@ static int acpi_pcc_retrieve_biosdata(struct pcc_acpi *pcc)
>  	}
>  
>  	if (pcc->num_sifr < hkey->package.count) {
> -		pr_err("SQTY reports bad SINF length\n");
> +		pr_err("SQTY reports bad SINF length SQTY: %ld SINF-pkg-count: %d\n",
> +		       pcc->num_sifr, hkey->package.count);

Both are unsigned so dont use d but u formatting.

>  		status = AE_ERROR;
>  		goto end;
>  	}
> @@ -968,6 +969,12 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
>  		return -ENODEV;
>  	}
>  
> +	/*
> +	 * Some DSDT-s have an of by one bug where the SINF package count is

off

> +	 * one higher then the SQTY reported value, allocate 1 entry extra.
> +	 */
> +	num_sifr++;
> +
>  	pcc = kzalloc(sizeof(struct pcc_acpi), GFP_KERNEL);
>  	if (!pcc) {
>  		pr_err("Couldn't allocate mem for pcc");
> 

-- 
 i.


  reply	other threads:[~2024-09-03 10:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-03  8:35 [PATCH 1/3] platform/x86: panasonic-laptop: Check minimum SQTY value Hans de Goede
2024-09-03  8:35 ` [PATCH 2/3] platform/x86: panasonic-laptop: Allocate 1 entry extra in the sinf array Hans de Goede
2024-09-03 10:33   ` Ilpo Järvinen [this message]
2024-09-03 11:07     ` Andy Shevchenko
2024-09-03  8:35 ` [PATCH 3/3] platform/x86: panasonic-laptop: Add support for programmable buttons Hans de Goede
2024-09-03 10:35   ` Ilpo Järvinen
2024-09-03 11:09     ` Andy Shevchenko
2024-09-03 10:29 ` [PATCH 1/3] platform/x86: panasonic-laptop: Check minimum SQTY value Ilpo Järvinen

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=a22f5196-7fa4-6fc4-7354-3fcf8e99c2d8@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=andy@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=jharmison@redhat.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=stable@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