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

Commit 6a99ad4a authored by Jon Povey's avatar Jon Povey Committed by Linus Torvalds
Browse files

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: default avatarJon Povey <jon.povey@racelogic.co.uk>
Cc: David Brownell <david-b@pacbell.net>
Acked-by: default avatarUwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
Cc: Gregory Bean <gbean@codeaurora.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 952e1c66
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -893,10 +893,12 @@ EXPORT_SYMBOL_GPL(gpio_sysfs_set_active_low);
void gpio_unexport(unsigned gpio)
void gpio_unexport(unsigned gpio)
{
{
	struct gpio_desc	*desc;
	struct gpio_desc	*desc;
	int			status = -EINVAL;
	int			status = 0;


	if (!gpio_is_valid(gpio))
	if (!gpio_is_valid(gpio)) {
		status = -EINVAL;
		goto done;
		goto done;
	}


	mutex_lock(&sysfs_lock);
	mutex_lock(&sysfs_lock);


@@ -911,7 +913,6 @@ void gpio_unexport(unsigned gpio)
			clear_bit(FLAG_EXPORT, &desc->flags);
			clear_bit(FLAG_EXPORT, &desc->flags);
			put_device(dev);
			put_device(dev);
			device_unregister(dev);
			device_unregister(dev);
			status = 0;
		} else
		} else
			status = -ENODEV;
			status = -ENODEV;
	}
	}