OSDN Git Service

gpiolib: only check line handle flags once
authorBartosz Golaszewski <brgl@bgdev.pl>
Mon, 16 Oct 2017 09:32:29 +0000 (11:32 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 19 Oct 2017 20:32:39 +0000 (22:32 +0200)
commit418ee8e91fe7fc90ffb6bce391304e084f77bce4
treec39b97bc1181c875c04e90187d0140899e4126bf
parenteec1d566cdf94b57e8f5ba9fe60eea214929bcfc
gpiolib: only check line handle flags once

There's no need to check the validity of handle request flags more
than once, right after copying the data from user. Move the check
out of the for loop and simplify the error path by bailing out before
allocating any resources.

Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib.c