diff options
author | Peter Popovec <popovec@oko.fei.tuke.sk> | 2012-12-15 01:57:25 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-12-17 01:02:51 -0500 |
commit | a455e2985f57e2a71566bb8850094af38b2c932d (patch) | |
tree | 0504636d0a03a6a1d674ab630768a10eac1df2e8 | |
parent | da5ee074ce8e07b9a91596de3576b59990c0c8c6 (diff) |
Input: walkera0701 - fix crash on startup
The driver's timer must be set up before enabling IRQ handler, otherwise
bad things may happen.
Reported-and-tested-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Peter Popovec <popovec@fei.tuke.sk>
CC: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r-- | drivers/input/joystick/walkera0701.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/input/joystick/walkera0701.c b/drivers/input/joystick/walkera0701.c index 4dfa1eed4b7..f8f892b076e 100644 --- a/drivers/input/joystick/walkera0701.c +++ b/drivers/input/joystick/walkera0701.c | |||
@@ -196,6 +196,7 @@ static void walkera0701_close(struct input_dev *dev) | |||
196 | struct walkera_dev *w = input_get_drvdata(dev); | 196 | struct walkera_dev *w = input_get_drvdata(dev); |
197 | 197 | ||
198 | parport_disable_irq(w->parport); | 198 | parport_disable_irq(w->parport); |
199 | hrtimer_cancel(&w->timer); | ||
199 | } | 200 | } |
200 | 201 | ||
201 | static int walkera0701_connect(struct walkera_dev *w, int parport) | 202 | static int walkera0701_connect(struct walkera_dev *w, int parport) |
@@ -224,6 +225,9 @@ static int walkera0701_connect(struct walkera_dev *w, int parport) | |||
224 | if (parport_claim(w->pardevice)) | 225 | if (parport_claim(w->pardevice)) |
225 | goto init_err1; | 226 | goto init_err1; |
226 | 227 | ||
228 | hrtimer_init(&w->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | ||
229 | w->timer.function = timer_handler; | ||
230 | |||
227 | w->input_dev = input_allocate_device(); | 231 | w->input_dev = input_allocate_device(); |
228 | if (!w->input_dev) | 232 | if (!w->input_dev) |
229 | goto init_err2; | 233 | goto init_err2; |
@@ -254,8 +258,6 @@ static int walkera0701_connect(struct walkera_dev *w, int parport) | |||
254 | if (err) | 258 | if (err) |
255 | goto init_err3; | 259 | goto init_err3; |
256 | 260 | ||
257 | hrtimer_init(&w->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | ||
258 | w->timer.function = timer_handler; | ||
259 | return 0; | 261 | return 0; |
260 | 262 | ||
261 | init_err3: | 263 | init_err3: |
@@ -271,7 +273,6 @@ static int walkera0701_connect(struct walkera_dev *w, int parport) | |||
271 | 273 | ||
272 | static void walkera0701_disconnect(struct walkera_dev *w) | 274 | static void walkera0701_disconnect(struct walkera_dev *w) |
273 | { | 275 | { |
274 | hrtimer_cancel(&w->timer); | ||
275 | input_unregister_device(w->input_dev); | 276 | input_unregister_device(w->input_dev); |
276 | parport_release(w->pardevice); | 277 | parport_release(w->pardevice); |
277 | parport_unregister_device(w->pardevice); | 278 | parport_unregister_device(w->pardevice); |