From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-la0-f45.google.com ([209.85.215.45]:35344 "EHLO mail-la0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753362AbbEOKLX (ORCPT ); Fri, 15 May 2015 06:11:23 -0400 From: Johan Hovold To: Greg Kroah-Hartman Cc: linus.walleij@linaro.org, stable@vger.kernel.org, stable-commits@vger.kernel.org, Johan Hovold Subject: [PATCH-3.14 1/2] gpio: unregister gpiochip device before removing it Date: Fri, 15 May 2015 12:10:58 +0200 Message-Id: <1431684659-11645-1-git-send-email-johan@kernel.org> In-Reply-To: <20150515100754.GA13976@localhost> References: <20150515100754.GA13976@localhost> Sender: stable-owner@vger.kernel.org List-ID: commit 01cca93a9491ed95992523ff7e79dd9bfcdea8e0 upstream. Unregister gpiochip device (used to export information through sysfs) before removing it internally. This way removal will reverse addition. Signed-off-by: Johan Hovold Signed-off-by: Linus Walleij --- drivers/gpio/gpiolib.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index f1fc14c33be5..7fc186c6927d 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1265,6 +1265,8 @@ int gpiochip_remove(struct gpio_chip *chip) int status = 0; unsigned id; + gpiochip_unexport(chip); + spin_lock_irqsave(&gpio_lock, flags); gpiochip_remove_pin_ranges(chip); @@ -1286,9 +1288,6 @@ int gpiochip_remove(struct gpio_chip *chip) spin_unlock_irqrestore(&gpio_lock, flags); - if (status == 0) - gpiochip_unexport(chip); - return status; } EXPORT_SYMBOL_GPL(gpiochip_remove); -- 2.3.6