Skip to content

Commit 3415a5f

Browse files
author
Gustavo F. Padovan
committed
Bluetooth: Fix input device registration
This is a regression fix. It made impossible use input device when hid fails. Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
1 parent 679344e commit 3415a5f

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

‎net/bluetooth/hidp/core.c‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ static int hidp_setup_input(struct hidp_session *session,
812812
struct hidp_connadd_req *req)
813813
{
814814
struct input_dev *input;
815-
int err, i;
815+
int i;
816816

817817
input = input_allocate_device();
818818
if (!input)
@@ -859,13 +859,6 @@ static int hidp_setup_input(struct hidp_session *session,
859859

860860
input->event = hidp_input_event;
861861

862-
err = input_register_device(input);
863-
if (err < 0) {
864-
input_free_device(input);
865-
session->input = NULL;
866-
return err;
867-
}
868-
869862
return 0;
870863
}
871864

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

1070-
err = hid_add_device(session->hid);
1063+
if (session->hid)
1064+
err = hid_add_device(session->hid);
1065+
else
1066+
err = input_register_device(session->input);
1067+
10711068
if (err < 0) {
10721069
atomic_inc(&session->terminate);
10731070
wake_up_process(session->task);

0 commit comments

Comments
 (0)