Skip to content

Commit ba2dc1c

Browse files
jwrdegoedeBartosz Golaszewski
authored andcommitted
gpiolib: Fix using uninitialized lookup-flags on ACPI platforms
Commit 8eb1f71 ("gpiolib: consolidate GPIO lookups") refactors fwnode_get_named_gpiod() and gpiod_get_index() into a unified gpiod_find_and_request() helper. The old functions both initialized their local lookupflags variable to GPIO_LOOKUP_FLAGS_DEFAULT, but the new code leaves it uninitialized. This is a problem for at least ACPI platforms, where acpi_find_gpio() only does a bunch of *lookupflags |= GPIO_* statements and thus relies on the variable being initialized. The variable not being initialized leads to: 1. Potentially the wrong flags getting used 2. The check for conflicting lookup flags in gpiod_configure_flags(): "multiple pull-up, pull-down or pull-disable enabled, invalid config" sometimes triggering, making the GPIO unavailable Restore the initialization of lookupflags to GPIO_LOOKUP_FLAGS_DEFAULT to fix this. Fixes: 8eb1f71 ("gpiolib: consolidate GPIO lookups") Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 1b929c0 commit ba2dc1c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpio/gpiolib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3905,8 +3905,8 @@ static struct gpio_desc *gpiod_find_and_request(struct device *consumer,
39053905
const char *label,
39063906
bool platform_lookup_allowed)
39073907
{
3908+
unsigned long lookupflags = GPIO_LOOKUP_FLAGS_DEFAULT;
39083909
struct gpio_desc *desc = ERR_PTR(-ENOENT);
3909-
unsigned long lookupflags;
39103910
int ret;
39113911

39123912
if (!IS_ERR_OR_NULL(fwnode))

0 commit comments

Comments
 (0)