[PATCH] gpio: Add simple poweroff-gpio driver

Andrew Lunn andrew at lunn.ch
Thu May 3 04:50:26 EDT 2012


> +	if (gpio_request(gpio_num, "poweroff-gpio")) {
> +		pr_err("%s: Could not get GPIO %d", __func__, gpio_num);
> +		return -ENODEV;
> +	}
> +	if (gpio_direction_output(gpio_num, gpio_active_low)) {
> +		pr_err("%s: Could not set direction of GPIO %d",
> +		       __func__, gpio_num);
> +		return -ENODEV;
> +	}

On error, you are missing a gpio_free().

   Andrew



More information about the linux-arm-kernel mailing list