Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 615aedd6 authored by Peter Hurley's avatar Peter Hurley Committed by Gustavo Padovan
Browse files

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: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent 1c97e94c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock,
failed:
	up_write(&hidp_session_sem);

	input_free_device(session->input);
	kfree(session);
	return err;
}