• Ryan Mallon's avatar
    gpiolib: Refactor gpio_export · fc4e2514
    Ryan Mallon authored
    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: default avatarRyan Mallon <rmallon@gmail.com>
    Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    fc4e2514
gpiolib.c 46.1 KB