Commit 90338947 authored by Gustavo Padovan's avatar Gustavo Padovan

Bluetooth: Remove err parameter from alloc_skb()

Use ERR_PTR maginc instead.
Signed-off-by: default avatarGustavo Padovan <gustavo@padovan.org>
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent bd4b1653
...@@ -519,7 +519,7 @@ struct l2cap_ops { ...@@ -519,7 +519,7 @@ struct l2cap_ops {
void (*close) (void *data); void (*close) (void *data);
void (*state_change) (void *data, int state); void (*state_change) (void *data, int state);
struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan,
unsigned long len, int nb, int *err); unsigned long len, int nb);
}; };
......
...@@ -1563,7 +1563,7 @@ static inline int l2cap_skbuff_fromiovec(struct l2cap_chan *chan, ...@@ -1563,7 +1563,7 @@ static inline int l2cap_skbuff_fromiovec(struct l2cap_chan *chan,
{ {
struct l2cap_conn *conn = chan->conn; struct l2cap_conn *conn = chan->conn;
struct sk_buff **frag; struct sk_buff **frag;
int err, sent = 0; int sent = 0;
if (memcpy_fromiovec(skb_put(skb, count), msg->msg_iov, count)) if (memcpy_fromiovec(skb_put(skb, count), msg->msg_iov, count))
return -EFAULT; return -EFAULT;
...@@ -1577,11 +1577,10 @@ static inline int l2cap_skbuff_fromiovec(struct l2cap_chan *chan, ...@@ -1577,11 +1577,10 @@ static inline int l2cap_skbuff_fromiovec(struct l2cap_chan *chan,
count = min_t(unsigned int, conn->mtu, len); count = min_t(unsigned int, conn->mtu, len);
*frag = chan->ops->alloc_skb(chan, count, *frag = chan->ops->alloc_skb(chan, count,
msg->msg_flags & MSG_DONTWAIT, msg->msg_flags & MSG_DONTWAIT);
&err);
if (!*frag) if (IS_ERR(*frag))
return err; return PTR_ERR(*frag);
if (memcpy_fromiovec(skb_put(*frag, count), msg->msg_iov, count)) if (memcpy_fromiovec(skb_put(*frag, count), msg->msg_iov, count))
return -EFAULT; return -EFAULT;
...@@ -1610,10 +1609,9 @@ static struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan, ...@@ -1610,10 +1609,9 @@ static struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan,
count = min_t(unsigned int, (conn->mtu - hlen), len); count = min_t(unsigned int, (conn->mtu - hlen), len);
skb = chan->ops->alloc_skb(chan, count + hlen, skb = chan->ops->alloc_skb(chan, count + hlen,
msg->msg_flags & MSG_DONTWAIT, &err); msg->msg_flags & MSG_DONTWAIT);
if (IS_ERR(skb))
if (!skb) return skb;
return ERR_PTR(err);
skb->priority = priority; skb->priority = priority;
...@@ -1645,10 +1643,9 @@ static struct sk_buff *l2cap_create_basic_pdu(struct l2cap_chan *chan, ...@@ -1645,10 +1643,9 @@ static struct sk_buff *l2cap_create_basic_pdu(struct l2cap_chan *chan,
count = min_t(unsigned int, (conn->mtu - hlen), len); count = min_t(unsigned int, (conn->mtu - hlen), len);
skb = chan->ops->alloc_skb(chan, count + hlen, skb = chan->ops->alloc_skb(chan, count + hlen,
msg->msg_flags & MSG_DONTWAIT, &err); msg->msg_flags & MSG_DONTWAIT);
if (IS_ERR(skb))
if (!skb) return skb;
return ERR_PTR(err);
skb->priority = priority; skb->priority = priority;
...@@ -1693,10 +1690,9 @@ static struct sk_buff *l2cap_create_iframe_pdu(struct l2cap_chan *chan, ...@@ -1693,10 +1690,9 @@ static struct sk_buff *l2cap_create_iframe_pdu(struct l2cap_chan *chan,
count = min_t(unsigned int, (conn->mtu - hlen), len); count = min_t(unsigned int, (conn->mtu - hlen), len);
skb = chan->ops->alloc_skb(chan, count + hlen, skb = chan->ops->alloc_skb(chan, count + hlen,
msg->msg_flags & MSG_DONTWAIT, &err); msg->msg_flags & MSG_DONTWAIT);
if (IS_ERR(skb))
if (!skb) return skb;
return ERR_PTR(err);
/* Create L2CAP header */ /* Create L2CAP header */
lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE); lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE);
......
...@@ -927,12 +927,16 @@ static void l2cap_sock_state_change_cb(void *data, int state) ...@@ -927,12 +927,16 @@ static void l2cap_sock_state_change_cb(void *data, int state)
} }
static struct sk_buff *l2cap_sock_alloc_skb_cb(struct l2cap_chan *chan, static struct sk_buff *l2cap_sock_alloc_skb_cb(struct l2cap_chan *chan,
unsigned long len, int nb, unsigned long len, int nb)
int *err)
{ {
struct sock *sk = chan->sk; struct sk_buff *skb;
int err;
skb = bt_skb_send_alloc(chan->sk, len, nb, &err);
if (!skb)
return ERR_PTR(err);
return bt_skb_send_alloc(sk, len, nb, err); return skb;
} }
static struct l2cap_ops l2cap_chan_ops = { static struct l2cap_ops l2cap_chan_ops = {
......
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