Commit 78794903 authored by Wei Yongjun's avatar Wei Yongjun Committed by Marcel Holtmann

Bluetooth: fix return value check

In case of error, the function bt_skb_alloc() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should
be replaced with NULL test.
Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 05c75e36
...@@ -336,8 +336,8 @@ static inline int skbuff_copy(void *msg, int len, int count, int mtu, ...@@ -336,8 +336,8 @@ static inline int skbuff_copy(void *msg, int len, int count, int mtu,
count = min_t(unsigned int, mtu, len); count = min_t(unsigned int, mtu, len);
tmp = bt_skb_alloc(count, GFP_ATOMIC); tmp = bt_skb_alloc(count, GFP_ATOMIC);
if (IS_ERR(tmp)) if (!tmp)
return PTR_ERR(tmp); return -ENOMEM;
*frag = tmp; *frag = tmp;
...@@ -383,8 +383,8 @@ static struct sk_buff *create_pdu(struct l2cap_conn *conn, void *msg, ...@@ -383,8 +383,8 @@ static struct sk_buff *create_pdu(struct l2cap_conn *conn, void *msg,
BT_DBG("conn %p len %zu mtu %d count %d", conn, len, conn->mtu, count); BT_DBG("conn %p len %zu mtu %d count %d", conn, len, conn->mtu, count);
skb = bt_skb_alloc(count + L2CAP_HDR_SIZE, GFP_ATOMIC); skb = bt_skb_alloc(count + L2CAP_HDR_SIZE, GFP_ATOMIC);
if (IS_ERR(skb)) if (!skb)
return skb; return ERR_PTR(-ENOMEM);
skb->priority = priority; skb->priority = priority;
......
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