aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikel Astiz <mikel.astiz@bmw-carit.de>2012-04-11 02:48:48 -0400
committerGustavo Padovan <gustavo@padovan.org>2012-05-09 00:40:32 -0400
commit088ce088ec115ee4bc89549b07b182e65dce9235 (patch)
tree6646c55d741c01611914e6eb939b590a41cbd511
parentabc5de8f4e68ea785e32b91e456f467d2a2fb7db (diff)
Bluetooth: Remove unnecessary check
The function already fails if the given size is greater than the MTU, so there is no need to consider that case afterwards. Signed-off-by: Mikel Astiz <mikel.astiz.oss@gmail.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
-rw-r--r--net/bluetooth/sco.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index f6ab12907963..728dedb1b01e 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -233,7 +233,7 @@ static inline int sco_send_frame(struct sock *sk, struct msghdr *msg, int len)
233{ 233{
234 struct sco_conn *conn = sco_pi(sk)->conn; 234 struct sco_conn *conn = sco_pi(sk)->conn;
235 struct sk_buff *skb; 235 struct sk_buff *skb;
236 int err, count; 236 int err;
237 237
238 /* Check outgoing MTU */ 238 /* Check outgoing MTU */
239 if (len > conn->mtu) 239 if (len > conn->mtu)
@@ -241,20 +241,18 @@ static inline int sco_send_frame(struct sock *sk, struct msghdr *msg, int len)
241 241
242 BT_DBG("sk %p len %d", sk, len); 242 BT_DBG("sk %p len %d", sk, len);
243 243
244 count = min_t(unsigned int, conn->mtu, len); 244 skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err);
245 skb = bt_skb_send_alloc(sk, count,
246 msg->msg_flags & MSG_DONTWAIT, &err);
247 if (!skb) 245 if (!skb)
248 return err; 246 return err;
249 247
250 if (memcpy_fromiovec(skb_put(skb, count), msg->msg_iov, count)) { 248 if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) {
251 kfree_skb(skb); 249 kfree_skb(skb);
252 return -EFAULT; 250 return -EFAULT;
253 } 251 }
254 252
255 hci_send_sco(conn->hcon, skb); 253 hci_send_sco(conn->hcon, skb);
256 254
257 return count; 255 return len;
258} 256}
259 257
260static inline void sco_recv_frame(struct sco_conn *conn, struct sk_buff *skb) 258static inline void sco_recv_frame(struct sco_conn *conn, struct sk_buff *skb)