diff options
author | Arve Hjønnevåg <arve@android.com> | 2010-04-01 19:52:27 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:38:19 -0800 |
commit | 88b6f69d91dc18d6000a6bf95ba4f4bc5803eeed (patch) | |
tree | 79434d24598b63475e2137d657fd453eede57457 /drivers | |
parent | 3e1a170fc31f1847aa90dde5ddd298d111ffaeac (diff) |
Input: gpio_event: Don't call gpio_cansleep before gpio_request.
If the gpio did not exist it would crash in gpiolib.
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/input/misc/gpio_matrix.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/input/misc/gpio_matrix.c b/drivers/input/misc/gpio_matrix.c index f645471b54dd..08b881325eac 100644 --- a/drivers/input/misc/gpio_matrix.c +++ b/drivers/input/misc/gpio_matrix.c @@ -336,18 +336,18 @@ int gpio_event_matrix_func(struct gpio_event_input_devs *input_devs, } for (i = 0; i < mi->noutputs; i++) { - if (gpio_cansleep(mi->output_gpios[i])) { - pr_err("gpiomatrix: unsupported output gpio %d," - " can sleep\n", mi->output_gpios[i]); - err = -EINVAL; - goto err_request_output_gpio_failed; - } err = gpio_request(mi->output_gpios[i], "gpio_kp_out"); if (err) { pr_err("gpiomatrix: gpio_request failed for " "output %d\n", mi->output_gpios[i]); goto err_request_output_gpio_failed; } + if (gpio_cansleep(mi->output_gpios[i])) { + pr_err("gpiomatrix: unsupported output gpio %d," + " can sleep\n", mi->output_gpios[i]); + err = -EINVAL; + goto err_output_gpio_configure_failed; + } if (mi->flags & GPIOKPF_DRIVE_INACTIVE) err = gpio_direction_output(mi->output_gpios[i], !(mi->flags & GPIOKPF_ACTIVE_HIGH)); |