]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - net/bluetooth/hidp/sock.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[karo-tx-linux.git] / net / bluetooth / hidp / sock.c
index 82a829d90b0f4a8f60013653bf0eed34237cb5b0..cb3fdde1968a0fabafe038382dbdf9dacd3e331f 100644 (file)
@@ -77,21 +77,12 @@ static int hidp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
                        return err;
                }
 
-               if (csock->sk->sk_state != BT_CONNECTED ||
-                               isock->sk->sk_state != BT_CONNECTED) {
-                       sockfd_put(csock);
-                       sockfd_put(isock);
-                       return -EBADFD;
-               }
+               err = hidp_connection_add(&ca, csock, isock);
+               if (!err && copy_to_user(argp, &ca, sizeof(ca)))
+                       err = -EFAULT;
 
-               err = hidp_add_connection(&ca, csock, isock);
-               if (!err) {
-                       if (copy_to_user(argp, &ca, sizeof(ca)))
-                               err = -EFAULT;
-               } else {
-                       sockfd_put(csock);
-                       sockfd_put(isock);
-               }
+               sockfd_put(csock);
+               sockfd_put(isock);
 
                return err;
 
@@ -102,7 +93,7 @@ static int hidp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
                if (copy_from_user(&cd, argp, sizeof(cd)))
                        return -EFAULT;
 
-               return hidp_del_connection(&cd);
+               return hidp_connection_del(&cd);
 
        case HIDPGETCONNLIST:
                if (copy_from_user(&cl, argp, sizeof(cl)))
@@ -284,7 +275,7 @@ int __init hidp_init_sockets(void)
                goto error;
        }
 
-       err = bt_procfs_init(THIS_MODULE, &init_net, "hidp", &hidp_sk_list, NULL);
+       err = bt_procfs_init(&init_net, "hidp", &hidp_sk_list, NULL);
        if (err < 0) {
                BT_ERR("Failed to create HIDP proc file");
                bt_sock_unregister(BTPROTO_HIDP);
@@ -296,7 +287,6 @@ int __init hidp_init_sockets(void)
        return 0;
 
 error:
-       BT_ERR("Can't register HIDP socket");
        proto_unregister(&hidp_proto);
        return err;
 }
@@ -304,8 +294,6 @@ error:
 void __exit hidp_cleanup_sockets(void)
 {
        bt_procfs_cleanup(&init_net, "hidp");
-       if (bt_sock_unregister(BTPROTO_HIDP) < 0)
-               BT_ERR("Can't unregister HIDP socket");
-
+       bt_sock_unregister(BTPROTO_HIDP);
        proto_unregister(&hidp_proto);
 }