From: Jon Povey Date: Tue, 27 Jul 2010 20:18:06 +0000 (-0700) Subject: gpio: fix spurious printk when freeing a gpio X-Git-Tag: upstream/snapshot3+hdmi~13828 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6a99ad4a2e1b1693ffe8e40cc0dddfc633ce2a50;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git gpio: fix spurious printk when freeing a gpio When freeing a gpio that has not been exported, gpio_unexport() prints a debug message when it should just fall through silently. Example spurious message: gpio_unexport: gpio0 status -22 Signed-off-by: Jon Povey Cc: David Brownell Acked-by: Uwe Kleine-K?nig Cc: Gregory Bean Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 3ca3654..4e51fe3 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -893,10 +893,12 @@ EXPORT_SYMBOL_GPL(gpio_sysfs_set_active_low); void gpio_unexport(unsigned gpio) { struct gpio_desc *desc; - int status = -EINVAL; + int status = 0; - if (!gpio_is_valid(gpio)) + if (!gpio_is_valid(gpio)) { + status = -EINVAL; goto done; + } mutex_lock(&sysfs_lock); @@ -911,7 +913,6 @@ void gpio_unexport(unsigned gpio) clear_bit(FLAG_EXPORT, &desc->flags); put_device(dev); device_unregister(dev); - status = 0; } else status = -ENODEV; }