summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hidp/core.c
diff options
context:
space:
mode:
authorGustavo F. Padovan2011-10-07 02:17:32 +0200
committerGustavo F. Padovan2011-10-07 04:15:05 +0200
commit3415a5fdde715062aa18bd6361f8e75cfbb31208 (patch)
tree137eb2d7a7433abb8a4f0cee388b19f8d76ee0d4 /net/bluetooth/hidp/core.c
parentBluetooth: Trasmit interrupt channel messages first (diff)
downloadkernel-qcow2-linux-3415a5fdde715062aa18bd6361f8e75cfbb31208.tar.gz
kernel-qcow2-linux-3415a5fdde715062aa18bd6361f8e75cfbb31208.tar.xz
kernel-qcow2-linux-3415a5fdde715062aa18bd6361f8e75cfbb31208.zip
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>
Diffstat (limited to 'net/bluetooth/hidp/core.c')
-rw-r--r--net/bluetooth/hidp/core.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index 6cb1d9e8eac5..8d99a17c478c 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -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)
@@ -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;
}
@@ -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);