Commit 088ce088 authored by Mikel Astiz's avatar Mikel Astiz Committed by Gustavo Padovan

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: default avatarMikel Astiz <mikel.astiz.oss@gmail.com>
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarGustavo Padovan <gustavo@padovan.org>
parent abc5de8f
...@@ -233,7 +233,7 @@ static inline int sco_send_frame(struct sock *sk, struct msghdr *msg, int len) ...@@ -233,7 +233,7 @@ static inline int sco_send_frame(struct sock *sk, struct msghdr *msg, int len)
{ {
struct sco_conn *conn = sco_pi(sk)->conn; struct sco_conn *conn = sco_pi(sk)->conn;
struct sk_buff *skb; struct sk_buff *skb;
int err, count; int err;
/* Check outgoing MTU */ /* Check outgoing MTU */
if (len > conn->mtu) if (len > conn->mtu)
...@@ -241,20 +241,18 @@ static inline int sco_send_frame(struct sock *sk, struct msghdr *msg, int len) ...@@ -241,20 +241,18 @@ static inline int sco_send_frame(struct sock *sk, struct msghdr *msg, int len)
BT_DBG("sk %p len %d", sk, len); BT_DBG("sk %p len %d", sk, len);
count = min_t(unsigned int, conn->mtu, len); skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err);
skb = bt_skb_send_alloc(sk, count,
msg->msg_flags & MSG_DONTWAIT, &err);
if (!skb) if (!skb)
return err; return err;
if (memcpy_fromiovec(skb_put(skb, count), msg->msg_iov, count)) { if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) {
kfree_skb(skb); kfree_skb(skb);
return -EFAULT; return -EFAULT;
} }
hci_send_sco(conn->hcon, skb); hci_send_sco(conn->hcon, skb);
return count; return len;
} }
static inline void sco_recv_frame(struct sco_conn *conn, struct sk_buff *skb) static inline void sco_recv_frame(struct sco_conn *conn, struct sk_buff *skb)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment