drivers: gpio: GPIO_DT_SPEC_GET_BY_IDX_OR: use default if idx invalid
It is not sufficient to check if the given node_id has the requested
property in GPIO_DT_SPEC_GET_BY_IDX_OR(), the index also needs to valid.
Change the logic to test for a valid index (which, in turn, also checks if
the property is valid), otherwise return the default value provided by the
caller.
Signed-off-by:
Henrik Brix Andersen <henrik@brixandersen.dk>
Loading
Please sign in to comment