Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cedb1881 authored by Anton Vorontsov's avatar Anton Vorontsov Committed by Grant Likely
Browse files

gpiolib: cosmetic improvements for error handling in gpiochip_add()



Hopefully it makes the code look nicer and makes it easier to extend
this function.

Signed-off-by: default avatarAnton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
CC: devicetree-discuss@lists.ozlabs.org
CC: linux-kernel@vger.kernel.org
parent ac80a51e
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -1101,11 +1101,17 @@ int gpiochip_add(struct gpio_chip *chip)

unlock:
	spin_unlock_irqrestore(&gpio_lock, flags);
	if (status == 0)

	if (status)
		goto fail;

	status = gpiochip_export(chip);
	if (status)
		goto fail;

	return 0;
fail:
	/* failures here can mean systems won't boot... */
	if (status)
	pr_err("gpiochip_add: gpios %d..%d (%s) failed to register\n",
		chip->base, chip->base + chip->ngpio - 1,
		chip->label ? : "generic");