提交 615aedd6 编写于 作者: P Peter Hurley 提交者: Gustavo F. Padovan

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: NPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: NGustavo F. Padovan <padovan@profusion.mobi>
上级 1c97e94c
...@@ -842,6 +842,8 @@ static int hidp_setup_input(struct hidp_session *session, ...@@ -842,6 +842,8 @@ static int hidp_setup_input(struct hidp_session *session,
err = input_register_device(input); err = input_register_device(input);
if (err < 0) { if (err < 0) {
input_free_device(input);
session->input = NULL;
hci_conn_put_device(session->conn); hci_conn_put_device(session->conn);
return err; return err;
} }
...@@ -1089,7 +1091,6 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, ...@@ -1089,7 +1091,6 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock,
failed: failed:
up_write(&hidp_session_sem); up_write(&hidp_session_sem);
input_free_device(session->input);
kfree(session); kfree(session);
return err; return err;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册