aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hidp
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2008-01-08 01:38:42 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:00:48 -0500
commit67b23219ce2f78352b0c566a472ff16c1b0fea9a (patch)
treec02e09a072d3461505033374e1026000abe2b753 /net/bluetooth/hidp
parent3becd578c5c9aafde6f562bb1dfe20d420bce6e8 (diff)
[BLUETOOTH]: Use sockfd_put()
The function sockfd_lookup uses fget on the value that is stored in the file field of the returned structure, so fput should ultimately be applied to this value. This can be done directly, but it seems better to use the specific macro sockfd_put, which does the same thing. The problem was fixed using the following semantic patch. (http://www.emn.fr/x-info/coccinelle/) // <smpl> @@ expression s; @@ s = sockfd_lookup(...) ... + sockfd_put(s); ?- fput(s->file); // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bluetooth/hidp')
-rw-r--r--net/bluetooth/hidp/sock.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/bluetooth/hidp/sock.c b/net/bluetooth/hidp/sock.c
index 3292b956a7c4..f4dd02ca9a96 100644
--- a/net/bluetooth/hidp/sock.c
+++ b/net/bluetooth/hidp/sock.c
@@ -86,13 +86,13 @@ static int hidp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
86 86
87 isock = sockfd_lookup(ca.intr_sock, &err); 87 isock = sockfd_lookup(ca.intr_sock, &err);
88 if (!isock) { 88 if (!isock) {
89 fput(csock->file); 89 sockfd_put(csock);
90 return err; 90 return err;
91 } 91 }
92 92
93 if (csock->sk->sk_state != BT_CONNECTED || isock->sk->sk_state != BT_CONNECTED) { 93 if (csock->sk->sk_state != BT_CONNECTED || isock->sk->sk_state != BT_CONNECTED) {
94 fput(csock->file); 94 sockfd_put(csock);
95 fput(isock->file); 95 sockfd_put(isock);
96 return -EBADFD; 96 return -EBADFD;
97 } 97 }
98 98
@@ -101,8 +101,8 @@ static int hidp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
101 if (copy_to_user(argp, &ca, sizeof(ca))) 101 if (copy_to_user(argp, &ca, sizeof(ca)))
102 err = -EFAULT; 102 err = -EFAULT;
103 } else { 103 } else {
104 fput(csock->file); 104 sockfd_put(csock);
105 fput(isock->file); 105 sockfd_put(isock);
106 } 106 }
107 107
108 return err; 108 return err;