Skip to content

Commit

Permalink
Bluetooth: Fix input device registration
Browse files Browse the repository at this point in the history
This is a regression fix. It made impossible use input device when hid
fails.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
  • Loading branch information
Gustavo F. Padovan committed Oct 7, 2011
1 parent 679344e commit 3415a5f
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions net/bluetooth/hidp/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ static int hidp_setup_input(struct hidp_session *session,
struct hidp_connadd_req *req)
{
struct input_dev *input;
int err, i;
int i;

input = input_allocate_device();
if (!input)
Expand Down Expand Up @@ -859,13 +859,6 @@ static int hidp_setup_input(struct hidp_session *session,

input->event = hidp_input_event;

err = input_register_device(input);
if (err < 0) {
input_free_device(input);
session->input = NULL;
return err;
}

return 0;
}

Expand Down Expand Up @@ -1067,7 +1060,11 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock,
!session->waiting_for_startup);
}

err = hid_add_device(session->hid);
if (session->hid)
err = hid_add_device(session->hid);
else
err = input_register_device(session->input);

if (err < 0) {
atomic_inc(&session->terminate);
wake_up_process(session->task);
Expand Down

0 comments on commit 3415a5f

Please sign in to comment.