diff options
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/hidp/core.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index 22e9ab1403a0..e01a9246c14d 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c | |||
@@ -330,11 +330,13 @@ static int hidp_get_raw_report(struct hid_device *hid, | |||
330 | 330 | ||
331 | /* Wait for the return of the report. The returned report | 331 | /* Wait for the return of the report. The returned report |
332 | gets put in session->report_return. */ | 332 | gets put in session->report_return. */ |
333 | while (test_bit(HIDP_WAITING_FOR_RETURN, &session->flags)) { | 333 | while (test_bit(HIDP_WAITING_FOR_RETURN, &session->flags) && |
334 | !atomic_read(&session->terminate)) { | ||
334 | int res; | 335 | int res; |
335 | 336 | ||
336 | res = wait_event_interruptible_timeout(session->report_queue, | 337 | res = wait_event_interruptible_timeout(session->report_queue, |
337 | !test_bit(HIDP_WAITING_FOR_RETURN, &session->flags), | 338 | !test_bit(HIDP_WAITING_FOR_RETURN, &session->flags) |
339 | || atomic_read(&session->terminate), | ||
338 | 5*HZ); | 340 | 5*HZ); |
339 | if (res == 0) { | 341 | if (res == 0) { |
340 | /* timeout */ | 342 | /* timeout */ |
@@ -399,11 +401,13 @@ static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, s | |||
399 | goto err; | 401 | goto err; |
400 | 402 | ||
401 | /* Wait for the ACK from the device. */ | 403 | /* Wait for the ACK from the device. */ |
402 | while (test_bit(HIDP_WAITING_FOR_SEND_ACK, &session->flags)) { | 404 | while (test_bit(HIDP_WAITING_FOR_SEND_ACK, &session->flags) && |
405 | !atomic_read(&session->terminate)) { | ||
403 | int res; | 406 | int res; |
404 | 407 | ||
405 | res = wait_event_interruptible_timeout(session->report_queue, | 408 | res = wait_event_interruptible_timeout(session->report_queue, |
406 | !test_bit(HIDP_WAITING_FOR_SEND_ACK, &session->flags), | 409 | !test_bit(HIDP_WAITING_FOR_SEND_ACK, &session->flags) |
410 | || atomic_read(&session->terminate), | ||
407 | 10*HZ); | 411 | 10*HZ); |
408 | if (res == 0) { | 412 | if (res == 0) { |
409 | /* timeout */ | 413 | /* timeout */ |