summaryrefslogtreecommitdiff
path: root/net/bluetooth
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2011-08-05 10:51:50 -0400
committerGustavo F. Padovan <padovan@profusion.mobi>2011-08-11 19:50:28 -0300
commit615aedd6e5add8104f031b0d547285652d04d330 (patch)
tree9c35724c899a9e468538b03e3dfffbe8ecfd63dc /net/bluetooth
parent1c97e94c0b7c56319754ee6f9ccd2e93fe1ee2b3 (diff)
Bluetooth: hidp: Only free input device if failed register
When an hidp connection is added for a boot protocol input device, only free the allocated device if device registration fails. Subsequent failures should only unregister the device (the input device api documents that unregister will also free the allocated device). Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hidp/core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index 26f0d109ff41..a859f9078df6 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -842,6 +842,8 @@ static int hidp_setup_input(struct hidp_session *session,
err = input_register_device(input);
if (err < 0) {
+ input_free_device(input);
+ session->input = NULL;
hci_conn_put_device(session->conn);
return err;
}
@@ -1089,7 +1091,6 @@ purge:
failed:
up_write(&hidp_session_sem);
- input_free_device(session->input);
kfree(session);
return err;
}