gpiolib: acpi: A couple of error checks amendmends
cover gpiolib: acpi: A couple of error checks amendmends
One error check is moved and one is dropped.
No functional changes intended.
Andy Shevchenko (2):
gpiolib: acpi: Remove never true check in acpi_get_gpiod_by_index()
gpiolib: acpi: Check for errors first in acpi_find_gpio()
drivers/gpio/gpiolib-acpi.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
PATCH 1/2 gpiolib: acpi: Remove never true check in acpi_get_gpiod_by_index()
The acpi_get_gpiod_by_index() never is called with adev being NULL. Remove the redundant check.
--- drivers/gpio/gpiolib-acpi.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpio/gpiolib-acpi.c +0 -3
@@ -873,9 +873,6 @@ static struct gpio_desc *acpi_get_gpiod_by_index(struct acpi_device *adev,struct acpi_gpio_lookup lookup;int ret; -if (!adev) -return ERR_PTR (-ENODEV ); -memset (&lookup,0 ,sizeof (lookup)); lookup.index = index;
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
PATCH 2/2 gpiolib: acpi: Check for errors first in acpi_find_gpio()
In reply to Andy ShevchenkoIt's better to parse the code when the usual pattern is being used, i.e. checking for error condition first.
There is no functional or code generation change (tested in LLVM).
--- drivers/gpio/gpiolib-acpi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpio/gpiolib-acpi.c +3 -2
@@ -973,10 +973,11 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,else desc =acpi_get_gpiod_from_data (fwnode, propname, idx, &info); -if (!IS_ERR (desc)) -break ;if (PTR_ERR (desc) == -EPROBE_DEFER )return ERR_CAST (desc); + +if (!IS_ERR (desc)) +break ; }/* Then from plain _CRS GPIOs */
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Quoted 6 lines · Andy Shevchenko
One error check is moved and one is dropped.
No functional changes intended.Andy Shevchenko (2):
gpiolib: acpi: Remove never true check inacpi_get_gpiod_by_index()
gpiolib: acpi: Check for errors first inacpi_find_gpio()
Both,
Quoted 11 lines · Mika Westerberg
Quoted 6 lines · Andy Shevchenko
One error check is moved and one is dropped.
No functional changes intended.Andy Shevchenko (2):
gpiolib: acpi: Remove never true check inacpi_get_gpiod_by_index()
gpiolib: acpi: Check for errors first inacpi_find_gpio()Both,
Acked-by Mika Westerberg <[email protected]>
Pushed to my review and testing queue, thanks!
Signature · 2 lines
With Best Regards, Andy Shevchenko