All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/x86: pcengines-apuv2: Add missing terminating entries to gpio-lookup tables
@ 2021-08-06 11:55 Hans de Goede
  2021-08-06 12:04 ` Hans de Goede
  0 siblings, 1 reply; 2+ messages in thread
From: Hans de Goede @ 2021-08-06 11:55 UTC (permalink / raw)
  To: Mark Gross, Andy Shevchenko; +Cc: Hans de Goede, platform-driver-x86

The gpiod_lookup_table.table passed to gpiod_add_lookup_table() must
be terminated with an empty entry, add this.

Note we have likely been getting away with this not being present because
the GPIO lookup code first matches on the dev_id, causing most lookups to
skip checking the table and the lookups which do check the table will
find a matching entry before reaching the end. With that said, terminating
these tables properly still is obviously the correct thing to do.

Fixes: f8eb0235f659 ("x86: pcengines apuv2 gpio/leds/keys platform driver")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/pcengines-apuv2.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/platform/x86/pcengines-apuv2.c b/drivers/platform/x86/pcengines-apuv2.c
index c37349f97bb8..d063d91db9bc 100644
--- a/drivers/platform/x86/pcengines-apuv2.c
+++ b/drivers/platform/x86/pcengines-apuv2.c
@@ -94,6 +94,7 @@ static struct gpiod_lookup_table gpios_led_table = {
 				NULL, 1, GPIO_ACTIVE_LOW),
 		GPIO_LOOKUP_IDX(AMD_FCH_GPIO_DRIVER_NAME, APU2_GPIO_LINE_LED3,
 				NULL, 2, GPIO_ACTIVE_LOW),
+		{} /* Terminating entry */
 	}
 };
 
@@ -123,6 +124,7 @@ static struct gpiod_lookup_table gpios_key_table = {
 	.table = {
 		GPIO_LOOKUP_IDX(AMD_FCH_GPIO_DRIVER_NAME, APU2_GPIO_LINE_MODESW,
 				NULL, 0, GPIO_ACTIVE_LOW),
+		{} /* Terminating entry */
 	}
 };
 
-- 
2.31.1


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

* Re: [PATCH] platform/x86: pcengines-apuv2: Add missing terminating entries to gpio-lookup tables
  2021-08-06 11:55 [PATCH] platform/x86: pcengines-apuv2: Add missing terminating entries to gpio-lookup tables Hans de Goede
@ 2021-08-06 12:04 ` Hans de Goede
  0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2021-08-06 12:04 UTC (permalink / raw)
  To: Mark Gross, Andy Shevchenko; +Cc: platform-driver-x86

Hi,

On 8/6/21 1:55 PM, Hans de Goede wrote:
> The gpiod_lookup_table.table passed to gpiod_add_lookup_table() must
> be terminated with an empty entry, add this.
> 
> Note we have likely been getting away with this not being present because
> the GPIO lookup code first matches on the dev_id, causing most lookups to
> skip checking the table and the lookups which do check the table will
> find a matching entry before reaching the end. With that said, terminating
> these tables properly still is obviously the correct thing to do.
> 
> Fixes: f8eb0235f659 ("x86: pcengines apuv2 gpio/leds/keys platform driver")
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

I've added this to my review-hans and the pdx86/fixes branches now.

Regards,

Hans


> ---
>  drivers/platform/x86/pcengines-apuv2.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/platform/x86/pcengines-apuv2.c b/drivers/platform/x86/pcengines-apuv2.c
> index c37349f97bb8..d063d91db9bc 100644
> --- a/drivers/platform/x86/pcengines-apuv2.c
> +++ b/drivers/platform/x86/pcengines-apuv2.c
> @@ -94,6 +94,7 @@ static struct gpiod_lookup_table gpios_led_table = {
>  				NULL, 1, GPIO_ACTIVE_LOW),
>  		GPIO_LOOKUP_IDX(AMD_FCH_GPIO_DRIVER_NAME, APU2_GPIO_LINE_LED3,
>  				NULL, 2, GPIO_ACTIVE_LOW),
> +		{} /* Terminating entry */
>  	}
>  };
>  
> @@ -123,6 +124,7 @@ static struct gpiod_lookup_table gpios_key_table = {
>  	.table = {
>  		GPIO_LOOKUP_IDX(AMD_FCH_GPIO_DRIVER_NAME, APU2_GPIO_LINE_MODESW,
>  				NULL, 0, GPIO_ACTIVE_LOW),
> +		{} /* Terminating entry */
>  	}
>  };
>  
> 


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

end of thread, other threads:[~2021-08-06 12:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-06 11:55 [PATCH] platform/x86: pcengines-apuv2: Add missing terminating entries to gpio-lookup tables Hans de Goede
2021-08-06 12:04 ` Hans de Goede

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.