aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@nokia.com>2011-01-11 10:20:20 -0500
committerGustavo F. Padovan <padovan@profusion.mobi>2011-02-07 22:40:08 -0500
commit5a08eccedaa1e12b74cf3afea9e11a9aefc29f73 (patch)
tree9bc0f14ce8785a32cf1d4cf4ebf1c297312fada8
parent17fa4b9dff72fb3a1a68cc80caf98fc941d2b8b3 (diff)
Bluetooth: Do not use assignments in IF conditions
Fix checkpatch warnings concerning assignments in if conditions. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@nokia.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
-rw-r--r--net/bluetooth/af_bluetooth.c6
-rw-r--r--net/bluetooth/cmtp/capi.c3
-rw-r--r--net/bluetooth/cmtp/core.c9
-rw-r--r--net/bluetooth/hci_core.c12
-rw-r--r--net/bluetooth/hci_event.c22
-rw-r--r--net/bluetooth/hidp/core.c9
-rw-r--r--net/bluetooth/l2cap.c5
7 files changed, 45 insertions, 21 deletions
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index c4cf3f595004..a6732b576a52 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -240,7 +240,8 @@ int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
240 if (flags & (MSG_OOB)) 240 if (flags & (MSG_OOB))
241 return -EOPNOTSUPP; 241 return -EOPNOTSUPP;
242 242
243 if (!(skb = skb_recv_datagram(sk, flags, noblock, &err))) { 243 skb = skb_recv_datagram(sk, flags, noblock, &err);
244 if (!skb) {
244 if (sk->sk_shutdown & RCV_SHUTDOWN) 245 if (sk->sk_shutdown & RCV_SHUTDOWN)
245 return 0; 246 return 0;
246 return err; 247 return err;
@@ -323,7 +324,8 @@ int bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
323 if (copied >= target) 324 if (copied >= target)
324 break; 325 break;
325 326
326 if ((err = sock_error(sk)) != 0) 327 err = sock_error(sk);
328 if (err)
327 break; 329 break;
328 if (sk->sk_shutdown & RCV_SHUTDOWN) 330 if (sk->sk_shutdown & RCV_SHUTDOWN)
329 break; 331 break;
diff --git a/net/bluetooth/cmtp/capi.c b/net/bluetooth/cmtp/capi.c
index 3487cfe74aec..67cff810c77d 100644
--- a/net/bluetooth/cmtp/capi.c
+++ b/net/bluetooth/cmtp/capi.c
@@ -155,7 +155,8 @@ static void cmtp_send_interopmsg(struct cmtp_session *session,
155 155
156 BT_DBG("session %p subcmd 0x%02x appl %d msgnum %d", session, subcmd, appl, msgnum); 156 BT_DBG("session %p subcmd 0x%02x appl %d msgnum %d", session, subcmd, appl, msgnum);
157 157
158 if (!(skb = alloc_skb(CAPI_MSG_BASELEN + 6 + len, GFP_ATOMIC))) { 158 skb = alloc_skb(CAPI_MSG_BASELEN + 6 + len, GFP_ATOMIC);
159 if (!skb) {
159 BT_ERR("Can't allocate memory for interoperability packet"); 160 BT_ERR("Can't allocate memory for interoperability packet");
160 return; 161 return;
161 } 162 }
diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c
index 8e5f292529ac..2cee71a714c4 100644
--- a/net/bluetooth/cmtp/core.c
+++ b/net/bluetooth/cmtp/core.c
@@ -115,7 +115,8 @@ static inline void cmtp_add_msgpart(struct cmtp_session *session, int id, const
115 115
116 size = (skb) ? skb->len + count : count; 116 size = (skb) ? skb->len + count : count;
117 117
118 if (!(nskb = alloc_skb(size, GFP_ATOMIC))) { 118 nskb = alloc_skb(size, GFP_ATOMIC);
119 if (!nskb) {
119 BT_ERR("Can't allocate memory for CAPI message"); 120 BT_ERR("Can't allocate memory for CAPI message");
120 return; 121 return;
121 } 122 }
@@ -216,7 +217,8 @@ static void cmtp_process_transmit(struct cmtp_session *session)
216 217
217 BT_DBG("session %p", session); 218 BT_DBG("session %p", session);
218 219
219 if (!(nskb = alloc_skb(session->mtu, GFP_ATOMIC))) { 220 nskb = alloc_skb(session->mtu, GFP_ATOMIC);
221 if (!nskb) {
220 BT_ERR("Can't allocate memory for new frame"); 222 BT_ERR("Can't allocate memory for new frame");
221 return; 223 return;
222 } 224 }
@@ -224,7 +226,8 @@ static void cmtp_process_transmit(struct cmtp_session *session)
224 while ((skb = skb_dequeue(&session->transmit))) { 226 while ((skb = skb_dequeue(&session->transmit))) {
225 struct cmtp_scb *scb = (void *) skb->cb; 227 struct cmtp_scb *scb = (void *) skb->cb;
226 228
227 if ((tail = (session->mtu - nskb->len)) < 5) { 229 tail = session->mtu - nskb->len;
230 if (tail < 5) {
228 cmtp_send_frame(session, nskb->data, nskb->len); 231 cmtp_send_frame(session, nskb->data, nskb->len);
229 skb_trim(nskb, 0); 232 skb_trim(nskb, 0);
230 tail = session->mtu; 233 tail = session->mtu;
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index bf6729a53378..2f003224d2ea 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -429,7 +429,8 @@ int hci_inquiry(void __user *arg)
429 if (copy_from_user(&ir, ptr, sizeof(ir))) 429 if (copy_from_user(&ir, ptr, sizeof(ir)))
430 return -EFAULT; 430 return -EFAULT;
431 431
432 if (!(hdev = hci_dev_get(ir.dev_id))) 432 hdev = hci_dev_get(ir.dev_id);
433 if (!hdev)
433 return -ENODEV; 434 return -ENODEV;
434 435
435 hci_dev_lock_bh(hdev); 436 hci_dev_lock_bh(hdev);
@@ -489,7 +490,8 @@ int hci_dev_open(__u16 dev)
489 struct hci_dev *hdev; 490 struct hci_dev *hdev;
490 int ret = 0; 491 int ret = 0;
491 492
492 if (!(hdev = hci_dev_get(dev))) 493 hdev = hci_dev_get(dev);
494 if (!hdev)
493 return -ENODEV; 495 return -ENODEV;
494 496
495 BT_DBG("%s %p", hdev->name, hdev); 497 BT_DBG("%s %p", hdev->name, hdev);
@@ -1940,7 +1942,11 @@ static void hci_cmd_task(unsigned long arg)
1940 } 1942 }
1941 1943
1942 /* Send queued commands */ 1944 /* Send queued commands */
1943 if (atomic_read(&hdev->cmd_cnt) && (skb = skb_dequeue(&hdev->cmd_q))) { 1945 if (atomic_read(&hdev->cmd_cnt)) {
1946 skb = skb_dequeue(&hdev->cmd_q);
1947 if (!skb)
1948 return;
1949
1944 kfree_skb(hdev->sent_cmd); 1950 kfree_skb(hdev->sent_cmd);
1945 1951
1946 hdev->sent_cmd = skb_clone(skb, GFP_ATOMIC); 1952 hdev->sent_cmd = skb_clone(skb, GFP_ATOMIC);
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 617f58363dbc..cee46cbe7aeb 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -851,11 +851,14 @@ static void hci_cs_add_sco(struct hci_dev *hdev, __u8 status)
851 hci_dev_lock(hdev); 851 hci_dev_lock(hdev);
852 852
853 acl = hci_conn_hash_lookup_handle(hdev, handle); 853 acl = hci_conn_hash_lookup_handle(hdev, handle);
854 if (acl && (sco = acl->link)) { 854 if (acl) {
855 sco->state = BT_CLOSED; 855 sco = acl->link;
856 if (sco) {
857 sco->state = BT_CLOSED;
856 858
857 hci_proto_connect_cfm(sco, status); 859 hci_proto_connect_cfm(sco, status);
858 hci_conn_del(sco); 860 hci_conn_del(sco);
861 }
859 } 862 }
860 863
861 hci_dev_unlock(hdev); 864 hci_dev_unlock(hdev);
@@ -1037,11 +1040,14 @@ static void hci_cs_setup_sync_conn(struct hci_dev *hdev, __u8 status)
1037 hci_dev_lock(hdev); 1040 hci_dev_lock(hdev);
1038 1041
1039 acl = hci_conn_hash_lookup_handle(hdev, handle); 1042 acl = hci_conn_hash_lookup_handle(hdev, handle);
1040 if (acl && (sco = acl->link)) { 1043 if (acl) {
1041 sco->state = BT_CLOSED; 1044 sco = acl->link;
1045 if (sco) {
1046 sco->state = BT_CLOSED;
1042 1047
1043 hci_proto_connect_cfm(sco, status); 1048 hci_proto_connect_cfm(sco, status);
1044 hci_conn_del(sco); 1049 hci_conn_del(sco);
1050 }
1045 } 1051 }
1046 1052
1047 hci_dev_unlock(hdev); 1053 hci_dev_unlock(hdev);
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index 29544c21f4b5..e0de92952f32 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -157,7 +157,8 @@ static int hidp_queue_event(struct hidp_session *session, struct input_dev *dev,
157 157
158 session->leds = newleds; 158 session->leds = newleds;
159 159
160 if (!(skb = alloc_skb(3, GFP_ATOMIC))) { 160 skb = alloc_skb(3, GFP_ATOMIC);
161 if (!skb) {
161 BT_ERR("Can't allocate memory for new frame"); 162 BT_ERR("Can't allocate memory for new frame");
162 return -ENOMEM; 163 return -ENOMEM;
163 } 164 }
@@ -250,7 +251,8 @@ static int __hidp_send_ctrl_message(struct hidp_session *session,
250 251
251 BT_DBG("session %p data %p size %d", session, data, size); 252 BT_DBG("session %p data %p size %d", session, data, size);
252 253
253 if (!(skb = alloc_skb(size + 1, GFP_ATOMIC))) { 254 skb = alloc_skb(size + 1, GFP_ATOMIC);
255 if (!skb) {
254 BT_ERR("Can't allocate memory for new frame"); 256 BT_ERR("Can't allocate memory for new frame");
255 return -ENOMEM; 257 return -ENOMEM;
256 } 258 }
@@ -283,7 +285,8 @@ static int hidp_queue_report(struct hidp_session *session,
283 285
284 BT_DBG("session %p hid %p data %p size %d", session, session->hid, data, size); 286 BT_DBG("session %p hid %p data %p size %d", session, session->hid, data, size);
285 287
286 if (!(skb = alloc_skb(size + 1, GFP_ATOMIC))) { 288 skb = alloc_skb(size + 1, GFP_ATOMIC);
289 if (!skb) {
287 BT_ERR("Can't allocate memory for new frame"); 290 BT_ERR("Can't allocate memory for new frame");
288 return -ENOMEM; 291 return -ENOMEM;
289 } 292 }
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index cbaa7409d877..28d2954f94a4 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -4724,7 +4724,10 @@ static int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 fl
4724{ 4724{
4725 struct l2cap_conn *conn = hcon->l2cap_data; 4725 struct l2cap_conn *conn = hcon->l2cap_data;
4726 4726
4727 if (!conn && !(conn = l2cap_conn_add(hcon, 0))) 4727 if (!conn)
4728 conn = l2cap_conn_add(hcon, 0);
4729
4730 if (!conn)
4728 goto drop; 4731 goto drop;
4729 4732
4730 BT_DBG("conn %p len %d flags 0x%x", conn, skb->len, flags); 4733 BT_DBG("conn %p len %d flags 0x%x", conn, skb->len, flags);