Commit 3415a5fd authored by Gustavo F. Padovan's avatar Gustavo F. Padovan

Bluetooth: Fix input device registration

This is a regression fix. It made impossible use input device when hid
fails.
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent 679344e4
...@@ -812,7 +812,7 @@ static int hidp_setup_input(struct hidp_session *session, ...@@ -812,7 +812,7 @@ static int hidp_setup_input(struct hidp_session *session,
struct hidp_connadd_req *req) struct hidp_connadd_req *req)
{ {
struct input_dev *input; struct input_dev *input;
int err, i; int i;
input = input_allocate_device(); input = input_allocate_device();
if (!input) if (!input)
...@@ -859,13 +859,6 @@ static int hidp_setup_input(struct hidp_session *session, ...@@ -859,13 +859,6 @@ static int hidp_setup_input(struct hidp_session *session,
input->event = hidp_input_event; input->event = hidp_input_event;
err = input_register_device(input);
if (err < 0) {
input_free_device(input);
session->input = NULL;
return err;
}
return 0; return 0;
} }
...@@ -1067,7 +1060,11 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, ...@@ -1067,7 +1060,11 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock,
!session->waiting_for_startup); !session->waiting_for_startup);
} }
if (session->hid)
err = hid_add_device(session->hid); err = hid_add_device(session->hid);
else
err = input_register_device(session->input);
if (err < 0) { if (err < 0) {
atomic_inc(&session->terminate); atomic_inc(&session->terminate);
wake_up_process(session->task); wake_up_process(session->task);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment