From 67b23219ce2f78352b0c566a472ff16c1b0fea9a Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Mon, 7 Jan 2008 22:38:42 -0800 Subject: [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/) // @@ expression s; @@ s = sockfd_lookup(...) ... + sockfd_put(s); ?- fput(s->file); // Signed-off-by: Julia Lawall Signed-off-by: David S. Miller --- net/bluetooth/hidp/sock.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'net/bluetooth/hidp') 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 isock = sockfd_lookup(ca.intr_sock, &err); if (!isock) { - fput(csock->file); + sockfd_put(csock); return err; } if (csock->sk->sk_state != BT_CONNECTED || isock->sk->sk_state != BT_CONNECTED) { - fput(csock->file); - fput(isock->file); + sockfd_put(csock); + sockfd_put(isock); return -EBADFD; } @@ -101,8 +101,8 @@ static int hidp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long if (copy_to_user(argp, &ca, sizeof(ca))) err = -EFAULT; } else { - fput(csock->file); - fput(isock->file); + sockfd_put(csock); + sockfd_put(isock); } return err; -- cgit v1.2.3