gpiolib: Remove duplicative check in gpiod_find_and_request()
PATCH 1/1 gpiolib: Remove duplicative check in gpiod_find_and_request()
The gpiod_find_by_fwnode() already checks for NULL and returns correct error code in case fwnode is invalid. Drop the respective check and assignment in the gpiod_find_and_request().
Signed-off-by Andy Shevchenko <[email protected]>
--- drivers/gpio/gpiolib.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpio/gpiolib.c +2 -5
@@ -3927,13 +3927,10 @@ static struct gpio_desc *gpiod_find_and_request(struct device *consumer, bool platform_lookup_allowed) {unsigned long lookupflags =GPIO_LOOKUP_FLAGS_DEFAULT ; -struct gpio_desc *desc =ERR_PTR (-ENOENT ); +struct gpio_desc *desc;int ret; -if (!IS_ERR_OR_NULL (fwnode)) - desc =gpiod_find_by_fwnode (fwnode, consumer, con_id, idx, - &flags, &lookupflags); - + desc =gpiod_find_by_fwnode (fwnode, consumer, con_id, idx, &flags, &lookupflags);if (gpiod_not_found (desc) && platform_lookup_allowed) {/* * Either we are not using DT or ACPI, or their lookup did not
Signature · 1 line
2.39.1
Quoted 5 lines · Andy Shevchenko
The
gpiod_find_by_fwnode()already checks for NULL and returns correct error code in case fwnode is invalid. Drop the respective check and assignment in thegpiod_find_and_request().Signed-off-by Andy Shevchenko <[email protected]>
Reviewed-by Linus Walleij <[email protected]>
Yours,
Linus Walleij
Bartosz Golaszewski
AppliedQuoted 31 lines · Andy Shevchenko
The
gpiod_find_by_fwnode()already checks for NULL and returns correct error code in case fwnode is invalid. Drop the respective check and assignment in thegpiod_find_and_request().Signed-off-by Andy Shevchenko <[email protected]>--- drivers/gpio/gpiolib.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)drivers/gpio/gpiolib.c +2
-6@@ -3927,13 +3927,10 @@ static struct gpio_desc *gpiod_find_and_request(struct device *consumer, bool platform_lookup_allowed) {unsigned long lookupflags =GPIO_LOOKUP_FLAGS_DEFAULT ; -struct gpio_desc *desc =ERR_PTR (-ENOENT ); +struct gpio_desc *desc;int ret; -if (!IS_ERR_OR_NULL (fwnode)) - desc =gpiod_find_by_fwnode (fwnode, consumer, con_id, idx, - &flags, &lookupflags); - + desc =gpiod_find_by_fwnode (fwnode, consumer, con_id, idx, &flags, &lookupflags);if (gpiod_not_found (desc) && platform_lookup_allowed) {/* * Either we are not using DT or ACPI, or their lookup did not --
Quoted 2 lines
2.39.1
Applied, thanks!
Bart