public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpiolib: acpi: initialize acpi_gpio_info struct
@ 2025-09-12 20:18 Sébastien Szymanski
  2025-09-13  0:46 ` Calvin Owens
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Sébastien Szymanski @ 2025-09-12 20:18 UTC (permalink / raw)
  To: Mika Westerberg, Andy Shevchenko, Linus Walleij,
	Bartosz Golaszewski
  Cc: Mika Westerberg, linux-gpio, linux-acpi, linux-kernel,
	Sébastien Szymanski

Since commit 7c010d463372 ("gpiolib: acpi: Make sure we fill struct
acpi_gpio_info"), uninitialized acpi_gpio_info struct are passed to
__acpi_find_gpio() and later in the call stack info->quirks is used in
acpi_populate_gpio_lookup. This breaks the i2c_hid_cpi driver:

[   58.122916] i2c_hid_acpi i2c-UNIW0001:00: HID over i2c has not been provided an Int IRQ
[   58.123097] i2c_hid_acpi i2c-UNIW0001:00: probe with driver i2c_hid_acpi failed with error -22

Fix this by initializing the acpi_gpio_info pass to __acpi_find_gpio()

Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220388
Fixes: 7c010d463372 ("gpiolib: acpi: Make sure we fill struct acpi_gpio_info")
Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
---
 drivers/gpio/gpiolib-acpi-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpiolib-acpi-core.c b/drivers/gpio/gpiolib-acpi-core.c
index 12b24a717e43f17621c054bfc4e9c2e287236d8c..d11bcaf1ae88421e5e5a11a2ba94983f437c413a 100644
--- a/drivers/gpio/gpiolib-acpi-core.c
+++ b/drivers/gpio/gpiolib-acpi-core.c
@@ -942,7 +942,7 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
 {
 	struct acpi_device *adev = to_acpi_device_node(fwnode);
 	bool can_fallback = acpi_can_fallback_to_crs(adev, con_id);
-	struct acpi_gpio_info info;
+	struct acpi_gpio_info info = {};
 	struct gpio_desc *desc;
 
 	desc = __acpi_find_gpio(fwnode, con_id, idx, can_fallback, &info);
@@ -992,7 +992,7 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *con_id,
 	int ret;
 
 	for (i = 0, idx = 0; idx <= index; i++) {
-		struct acpi_gpio_info info;
+		struct acpi_gpio_info info = {};
 		struct gpio_desc *desc;
 
 		/* Ignore -EPROBE_DEFER, it only matters if idx matches */

---
base-commit: 76eeb9b8de9880ca38696b2fb56ac45ac0a25c6c
change-id: 20250912-gpiolib-acpi-fix-7ee492ebd5e8

Best regards,
-- 
Sébastien Szymanski <sebastien.szymanski@armadeus.com>


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] gpiolib: acpi: initialize acpi_gpio_info struct
  2025-09-12 20:18 [PATCH] gpiolib: acpi: initialize acpi_gpio_info struct Sébastien Szymanski
@ 2025-09-13  0:46 ` Calvin Owens
  2025-09-13 10:10 ` Hans de Goede
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Calvin Owens @ 2025-09-13  0:46 UTC (permalink / raw)
  To: Sébastien Szymanski
  Cc: Mika Westerberg, Andy Shevchenko, Linus Walleij,
	Bartosz Golaszewski, Mika Westerberg, linux-gpio, linux-acpi,
	linux-kernel

On Friday 09/12 at 22:18 +0200, Sébastien Szymanski wrote:
> Since commit 7c010d463372 ("gpiolib: acpi: Make sure we fill struct
> acpi_gpio_info"), uninitialized acpi_gpio_info struct are passed to
> __acpi_find_gpio() and later in the call stack info->quirks is used in
> acpi_populate_gpio_lookup. This breaks the i2c_hid_cpi driver:
> 
> [   58.122916] i2c_hid_acpi i2c-UNIW0001:00: HID over i2c has not been provided an Int IRQ
> [   58.123097] i2c_hid_acpi i2c-UNIW0001:00: probe with driver i2c_hid_acpi failed with error -22
> 
> Fix this by initializing the acpi_gpio_info pass to __acpi_find_gpio()
> 
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220388
> Fixes: 7c010d463372 ("gpiolib: acpi: Make sure we fill struct acpi_gpio_info")
> Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>

Thanks Sébastien. This fixes the touchpad on my XPS 9340.

If you want it:

Tested-By: Calvin Owens <calvin@wbinvd.org>

> ---
>  drivers/gpio/gpiolib-acpi-core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpio/gpiolib-acpi-core.c b/drivers/gpio/gpiolib-acpi-core.c
> index 12b24a717e43f17621c054bfc4e9c2e287236d8c..d11bcaf1ae88421e5e5a11a2ba94983f437c413a 100644
> --- a/drivers/gpio/gpiolib-acpi-core.c
> +++ b/drivers/gpio/gpiolib-acpi-core.c
> @@ -942,7 +942,7 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
>  {
>  	struct acpi_device *adev = to_acpi_device_node(fwnode);
>  	bool can_fallback = acpi_can_fallback_to_crs(adev, con_id);
> -	struct acpi_gpio_info info;
> +	struct acpi_gpio_info info = {};
>  	struct gpio_desc *desc;
>  
>  	desc = __acpi_find_gpio(fwnode, con_id, idx, can_fallback, &info);
> @@ -992,7 +992,7 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *con_id,
>  	int ret;
>  
>  	for (i = 0, idx = 0; idx <= index; i++) {
> -		struct acpi_gpio_info info;
> +		struct acpi_gpio_info info = {};
>  		struct gpio_desc *desc;
>  
>  		/* Ignore -EPROBE_DEFER, it only matters if idx matches */
> 
> ---
> base-commit: 76eeb9b8de9880ca38696b2fb56ac45ac0a25c6c
> change-id: 20250912-gpiolib-acpi-fix-7ee492ebd5e8
> 
> Best regards,
> -- 
> Sébastien Szymanski <sebastien.szymanski@armadeus.com>
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] gpiolib: acpi: initialize acpi_gpio_info struct
  2025-09-12 20:18 [PATCH] gpiolib: acpi: initialize acpi_gpio_info struct Sébastien Szymanski
  2025-09-13  0:46 ` Calvin Owens
@ 2025-09-13 10:10 ` Hans de Goede
  2025-09-15  4:47 ` Mika Westerberg
  2025-09-15 15:40 ` Andy Shevchenko
  3 siblings, 0 replies; 8+ messages in thread
From: Hans de Goede @ 2025-09-13 10:10 UTC (permalink / raw)
  To: Sébastien Szymanski, Mika Westerberg, Andy Shevchenko,
	Linus Walleij, Bartosz Golaszewski
  Cc: Mika Westerberg, linux-gpio, linux-acpi, linux-kernel

Hi,

On 12-Sep-25 10:18 PM, Sébastien Szymanski wrote:
> Since commit 7c010d463372 ("gpiolib: acpi: Make sure we fill struct
> acpi_gpio_info"), uninitialized acpi_gpio_info struct are passed to
> __acpi_find_gpio() and later in the call stack info->quirks is used in
> acpi_populate_gpio_lookup. This breaks the i2c_hid_cpi driver:
> 
> [   58.122916] i2c_hid_acpi i2c-UNIW0001:00: HID over i2c has not been provided an Int IRQ
> [   58.123097] i2c_hid_acpi i2c-UNIW0001:00: probe with driver i2c_hid_acpi failed with error -22
> 
> Fix this by initializing the acpi_gpio_info pass to __acpi_find_gpio()
> 
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220388
> Fixes: 7c010d463372 ("gpiolib: acpi: Make sure we fill struct acpi_gpio_info")
> Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>

Thanks, I hit and debugged the same problem myself:

https://lore.kernel.org/linux-acpi/20250912221859.368173-1-hansg@kernel.org/

But your patch is better since I only fixed 1 of the 2 uninitialized
struct cases:

Tested-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Hans de Goede <hansg@kernel.org>

Andy, Mika this is a pretty serious regression in 6.17-rc# can you please
make sure to get this fix merged before 6.17 final.

Regards,

Hans


> ---
>  drivers/gpio/gpiolib-acpi-core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpio/gpiolib-acpi-core.c b/drivers/gpio/gpiolib-acpi-core.c
> index 12b24a717e43f17621c054bfc4e9c2e287236d8c..d11bcaf1ae88421e5e5a11a2ba94983f437c413a 100644
> --- a/drivers/gpio/gpiolib-acpi-core.c
> +++ b/drivers/gpio/gpiolib-acpi-core.c
> @@ -942,7 +942,7 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
>  {
>  	struct acpi_device *adev = to_acpi_device_node(fwnode);
>  	bool can_fallback = acpi_can_fallback_to_crs(adev, con_id);
> -	struct acpi_gpio_info info;
> +	struct acpi_gpio_info info = {};
>  	struct gpio_desc *desc;
>  
>  	desc = __acpi_find_gpio(fwnode, con_id, idx, can_fallback, &info);
> @@ -992,7 +992,7 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *con_id,
>  	int ret;
>  
>  	for (i = 0, idx = 0; idx <= index; i++) {
> -		struct acpi_gpio_info info;
> +		struct acpi_gpio_info info = {};
>  		struct gpio_desc *desc;
>  
>  		/* Ignore -EPROBE_DEFER, it only matters if idx matches */
> 
> ---
> base-commit: 76eeb9b8de9880ca38696b2fb56ac45ac0a25c6c
> change-id: 20250912-gpiolib-acpi-fix-7ee492ebd5e8
> 
> Best regards,


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] gpiolib: acpi: initialize acpi_gpio_info struct
  2025-09-12 20:18 [PATCH] gpiolib: acpi: initialize acpi_gpio_info struct Sébastien Szymanski
  2025-09-13  0:46 ` Calvin Owens
  2025-09-13 10:10 ` Hans de Goede
@ 2025-09-15  4:47 ` Mika Westerberg
  2025-09-15  6:30   ` Andy Shevchenko
  2025-09-15 15:40 ` Andy Shevchenko
  3 siblings, 1 reply; 8+ messages in thread
From: Mika Westerberg @ 2025-09-15  4:47 UTC (permalink / raw)
  To: Sébastien Szymanski
  Cc: Mika Westerberg, Andy Shevchenko, Linus Walleij,
	Bartosz Golaszewski, linux-gpio, linux-acpi, linux-kernel

On Fri, Sep 12, 2025 at 10:18:50PM +0200, Sébastien Szymanski wrote:
> Since commit 7c010d463372 ("gpiolib: acpi: Make sure we fill struct
> acpi_gpio_info"), uninitialized acpi_gpio_info struct are passed to
> __acpi_find_gpio() and later in the call stack info->quirks is used in
> acpi_populate_gpio_lookup. This breaks the i2c_hid_cpi driver:
> 
> [   58.122916] i2c_hid_acpi i2c-UNIW0001:00: HID over i2c has not been provided an Int IRQ
> [   58.123097] i2c_hid_acpi i2c-UNIW0001:00: probe with driver i2c_hid_acpi failed with error -22
> 
> Fix this by initializing the acpi_gpio_info pass to __acpi_find_gpio()
> 
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220388
> Fixes: 7c010d463372 ("gpiolib: acpi: Make sure we fill struct acpi_gpio_info")
> Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>

Should have stable tag too, I think. Andy can add that once he applies.

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] gpiolib: acpi: initialize acpi_gpio_info struct
  2025-09-15  4:47 ` Mika Westerberg
@ 2025-09-15  6:30   ` Andy Shevchenko
  2025-09-15  6:46     ` Mika Westerberg
  0 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2025-09-15  6:30 UTC (permalink / raw)
  To: Mika Westerberg
  Cc: Sébastien Szymanski, Mika Westerberg, Linus Walleij,
	Bartosz Golaszewski, linux-gpio, linux-acpi, linux-kernel

On Mon, Sep 15, 2025 at 06:47:03AM +0200, Mika Westerberg wrote:
> On Fri, Sep 12, 2025 at 10:18:50PM +0200, Sébastien Szymanski wrote:
> > Since commit 7c010d463372 ("gpiolib: acpi: Make sure we fill struct
> > acpi_gpio_info"), uninitialized acpi_gpio_info struct are passed to
> > __acpi_find_gpio() and later in the call stack info->quirks is used in
> > acpi_populate_gpio_lookup. This breaks the i2c_hid_cpi driver:
> > 
> > [   58.122916] i2c_hid_acpi i2c-UNIW0001:00: HID over i2c has not been provided an Int IRQ
> > [   58.123097] i2c_hid_acpi i2c-UNIW0001:00: probe with driver i2c_hid_acpi failed with error -22
> > 
> > Fix this by initializing the acpi_gpio_info pass to __acpi_find_gpio()
> > 
> > Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220388
> > Fixes: 7c010d463372 ("gpiolib: acpi: Make sure we fill struct acpi_gpio_info")
> > Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
> 
> Should have stable tag too, I think. Andy can add that once he applies.

I can add, but this won't appear in the respective mailing list. Or did I miss
a new tag for stable?

> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] gpiolib: acpi: initialize acpi_gpio_info struct
  2025-09-15  6:30   ` Andy Shevchenko
@ 2025-09-15  6:46     ` Mika Westerberg
  2025-09-15  6:55       ` Andy Shevchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Mika Westerberg @ 2025-09-15  6:46 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Sébastien Szymanski, Mika Westerberg, Linus Walleij,
	Bartosz Golaszewski, linux-gpio, linux-acpi, linux-kernel

On Mon, Sep 15, 2025 at 09:30:46AM +0300, Andy Shevchenko wrote:
> On Mon, Sep 15, 2025 at 06:47:03AM +0200, Mika Westerberg wrote:
> > On Fri, Sep 12, 2025 at 10:18:50PM +0200, Sébastien Szymanski wrote:
> > > Since commit 7c010d463372 ("gpiolib: acpi: Make sure we fill struct
> > > acpi_gpio_info"), uninitialized acpi_gpio_info struct are passed to
> > > __acpi_find_gpio() and later in the call stack info->quirks is used in
> > > acpi_populate_gpio_lookup. This breaks the i2c_hid_cpi driver:
> > > 
> > > [   58.122916] i2c_hid_acpi i2c-UNIW0001:00: HID over i2c has not been provided an Int IRQ
> > > [   58.123097] i2c_hid_acpi i2c-UNIW0001:00: probe with driver i2c_hid_acpi failed with error -22
> > > 
> > > Fix this by initializing the acpi_gpio_info pass to __acpi_find_gpio()
> > > 
> > > Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220388
> > > Fixes: 7c010d463372 ("gpiolib: acpi: Make sure we fill struct acpi_gpio_info")
> > > Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
> > 
> > Should have stable tag too, I think. Andy can add that once he applies.
> 
> I can add, but this won't appear in the respective mailing list. Or did I miss
> a new tag for stable?

It does not need to go to the mailing list. It's enough that it is
mentioned in the commit. E.g

  Cc: stable@vger.kernel.org

And the stable "machinery" will notice it once it hits the mainline.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] gpiolib: acpi: initialize acpi_gpio_info struct
  2025-09-15  6:46     ` Mika Westerberg
@ 2025-09-15  6:55       ` Andy Shevchenko
  0 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2025-09-15  6:55 UTC (permalink / raw)
  To: Mika Westerberg
  Cc: Sébastien Szymanski, Mika Westerberg, Linus Walleij,
	Bartosz Golaszewski, linux-gpio, linux-acpi, linux-kernel

On Mon, Sep 15, 2025 at 08:46:10AM +0200, Mika Westerberg wrote:
> On Mon, Sep 15, 2025 at 09:30:46AM +0300, Andy Shevchenko wrote:
> > On Mon, Sep 15, 2025 at 06:47:03AM +0200, Mika Westerberg wrote:
> > > On Fri, Sep 12, 2025 at 10:18:50PM +0200, Sébastien Szymanski wrote:
> > > > Since commit 7c010d463372 ("gpiolib: acpi: Make sure we fill struct
> > > > acpi_gpio_info"), uninitialized acpi_gpio_info struct are passed to
> > > > __acpi_find_gpio() and later in the call stack info->quirks is used in
> > > > acpi_populate_gpio_lookup. This breaks the i2c_hid_cpi driver:
> > > > 
> > > > [   58.122916] i2c_hid_acpi i2c-UNIW0001:00: HID over i2c has not been provided an Int IRQ
> > > > [   58.123097] i2c_hid_acpi i2c-UNIW0001:00: probe with driver i2c_hid_acpi failed with error -22
> > > > 
> > > > Fix this by initializing the acpi_gpio_info pass to __acpi_find_gpio()
> > > > 
> > > > Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220388
> > > > Fixes: 7c010d463372 ("gpiolib: acpi: Make sure we fill struct acpi_gpio_info")
> > > > Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
> > > 
> > > Should have stable tag too, I think. Andy can add that once he applies.
> > 
> > I can add, but this won't appear in the respective mailing list. Or did I miss
> > a new tag for stable?
> 
> It does not need to go to the mailing list. It's enough that it is
> mentioned in the commit. E.g
> 
>   Cc: stable@vger.kernel.org
> 
> And the stable "machinery" will notice it once it hits the mainline.

Fine, I'll add this, thanks!

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] gpiolib: acpi: initialize acpi_gpio_info struct
  2025-09-12 20:18 [PATCH] gpiolib: acpi: initialize acpi_gpio_info struct Sébastien Szymanski
                   ` (2 preceding siblings ...)
  2025-09-15  4:47 ` Mika Westerberg
@ 2025-09-15 15:40 ` Andy Shevchenko
  3 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2025-09-15 15:40 UTC (permalink / raw)
  To: Sébastien Szymanski
  Cc: Mika Westerberg, Linus Walleij, Bartosz Golaszewski,
	Mika Westerberg, linux-gpio, linux-acpi, linux-kernel

On Fri, Sep 12, 2025 at 10:18:50PM +0200, Sébastien Szymanski wrote:
> Since commit 7c010d463372 ("gpiolib: acpi: Make sure we fill struct
> acpi_gpio_info"), uninitialized acpi_gpio_info struct are passed to
> __acpi_find_gpio() and later in the call stack info->quirks is used in
> acpi_populate_gpio_lookup. This breaks the i2c_hid_cpi driver:
> 
> [   58.122916] i2c_hid_acpi i2c-UNIW0001:00: HID over i2c has not been provided an Int IRQ
> [   58.123097] i2c_hid_acpi i2c-UNIW0001:00: probe with driver i2c_hid_acpi failed with error -22
> 
> Fix this by initializing the acpi_gpio_info pass to __acpi_find_gpio()

Pushed to my review and testing queue, thanks!

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-09-15 15:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-12 20:18 [PATCH] gpiolib: acpi: initialize acpi_gpio_info struct Sébastien Szymanski
2025-09-13  0:46 ` Calvin Owens
2025-09-13 10:10 ` Hans de Goede
2025-09-15  4:47 ` Mika Westerberg
2025-09-15  6:30   ` Andy Shevchenko
2025-09-15  6:46     ` Mika Westerberg
2025-09-15  6:55       ` Andy Shevchenko
2025-09-15 15:40 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox