gpiolib: Refactor gpio_export
authorRyan Mallon <rmallon@gmail.com>
Mon, 22 Oct 2012 00:39:12 +0000 (11:39 +1100)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 20 Feb 2015 00:49:37 +0000 (00:49 +0000)
commit0bebb361e467ab9d9a790523fede2f32272444d9
tree9a1cdbfe31d0e460351ed1d18c3a9d52db9f2c86
parent6f7c3121580136cfcdfb07cf9d3f6f81d78d39dc
gpiolib: Refactor gpio_export

commit fc4e2514995d9cd7f3e1a67098ce65d72acf8ec7 upstream.

The gpio_export function uses nested if statements and the status
variable to handle the failure cases. This makes the function logic
difficult to follow. Refactor the code to abort immediately on failure
using goto. This makes the code slightly longer, but significantly
reduces the nesting and number of split lines and makes the code easier
to read.

Signed-off-by: Ryan Mallon <rmallon@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/gpio/gpiolib.c