aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_sock.c
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@nokia.com>2010-12-01 09:58:25 -0500
committerGustavo F. Padovan <padovan@profusion.mobi>2010-12-01 18:04:43 -0500
commit70f23020e6d89155504b5b39f22505f4aec6fa6f (patch)
tree91fb41030acd0d2a2ca3e55be2373c5a70284d0c /net/bluetooth/hci_sock.c
parent894718a6be69d8cfd191dc291b42be32a1e4851b (diff)
Bluetooth: clean up hci code
Do not use assignment in IF condition, remove extra spaces, fixing typos, simplify code. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@nokia.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/hci_sock.c')
-rw-r--r--net/bluetooth/hci_sock.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 83acd164d39e..b3753bad2a55 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -43,7 +43,7 @@
43#include <net/sock.h> 43#include <net/sock.h>
44 44
45#include <asm/system.h> 45#include <asm/system.h>
46#include <asm/uaccess.h> 46#include <linux/uaccess.h>
47#include <asm/unaligned.h> 47#include <asm/unaligned.h>
48 48
49#include <net/bluetooth/bluetooth.h> 49#include <net/bluetooth/bluetooth.h>
@@ -125,7 +125,8 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb)
125 continue; 125 continue;
126 } 126 }
127 127
128 if (!(nskb = skb_clone(skb, GFP_ATOMIC))) 128 nskb = skb_clone(skb, GFP_ATOMIC);
129 if (!nskb)
129 continue; 130 continue;
130 131
131 /* Put type byte before the data */ 132 /* Put type byte before the data */
@@ -370,7 +371,8 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_le
370 } 371 }
371 372
372 if (haddr->hci_dev != HCI_DEV_NONE) { 373 if (haddr->hci_dev != HCI_DEV_NONE) {
373 if (!(hdev = hci_dev_get(haddr->hci_dev))) { 374 hdev = hci_dev_get(haddr->hci_dev);
375 if (!hdev) {
374 err = -ENODEV; 376 err = -ENODEV;
375 goto done; 377 goto done;
376 } 378 }
@@ -457,7 +459,8 @@ static int hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
457 if (sk->sk_state == BT_CLOSED) 459 if (sk->sk_state == BT_CLOSED)
458 return 0; 460 return 0;
459 461
460 if (!(skb = skb_recv_datagram(sk, flags, noblock, &err))) 462 skb = skb_recv_datagram(sk, flags, noblock, &err);
463 if (!skb)
461 return err; 464 return err;
462 465
463 msg->msg_namelen = 0; 466 msg->msg_namelen = 0;
@@ -499,7 +502,8 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
499 502
500 lock_sock(sk); 503 lock_sock(sk);
501 504
502 if (!(hdev = hci_pi(sk)->hdev)) { 505 hdev = hci_pi(sk)->hdev;
506 if (!hdev) {
503 err = -EBADFD; 507 err = -EBADFD;
504 goto done; 508 goto done;
505 } 509 }
@@ -509,7 +513,8 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
509 goto done; 513 goto done;
510 } 514 }
511 515
512 if (!(skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err))) 516 skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err);
517 if (!skb)
513 goto done; 518 goto done;
514 519
515 if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) { 520 if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) {