[v1,2/6] gpiolib: acpi: Don't contaminate return parameter in case of error

Message ID 20171110134033.85461-2-andriy.shevchenko@linux.intel.com
State New
Headers show
Series
  • [v1,1/6] gpiolib: acpi: Assign polarity when call acpi_populate_gpio_lookup()
Related show

Commit Message

Andy Shevchenko Nov. 10, 2017, 1:40 p.m.
If error occurs, leave lookup parameter untouched.

There is no functional change, since all current callers just bail out
in case of error without using the assigned pieces.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpiolib-acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mika Westerberg Nov. 13, 2017, 11:15 a.m. | #1
On Fri, Nov 10, 2017 at 03:40:29PM +0200, Andy Shevchenko wrote:
> If error occurs, leave lookup parameter untouched.
> 
> There is no functional change, since all current callers just bail out
> in case of error without using the assigned pieces.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index 2a85d27eb028..f640445099ab 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -585,7 +585,6 @@  static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode,
 	 * The property was found and resolved, so need to lookup the GPIO based
 	 * on returned args.
 	 */
-	lookup->adev = args.adev;
 	if (args.nargs != 3)
 		return -EPROTO;
 
@@ -593,6 +592,7 @@  static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode,
 	lookup->pin_index = args.args[1];
 	lookup->active_low = !!args.args[2];
 
+	lookup->adev = args.adev;
 	return 0;
 }