Staging: rtl8192e: Cleaning up error handling
Moved error handling to one common block. This removes double checking if all txb->fragments[] were initialized. The original code worked fine, but this is cleaner. Signed-off-by: Felix Schlepper <f3sch.git@outlook.com> Link: https://lore.kernel.org/r/13b32131cd00a1f0b8793657a24ada71240a8350.1656078068.git.f3sch.git@outlook.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9fdc63fe40
commit
acde2522fa
|
@ -214,19 +214,19 @@ static struct rtllib_txb *rtllib_alloc_txb(int nr_frags, int txb_size,
|
||||||
|
|
||||||
for (i = 0; i < nr_frags; i++) {
|
for (i = 0; i < nr_frags; i++) {
|
||||||
txb->fragments[i] = dev_alloc_skb(txb_size);
|
txb->fragments[i] = dev_alloc_skb(txb_size);
|
||||||
if (unlikely(!txb->fragments[i])) {
|
if (unlikely(!txb->fragments[i]))
|
||||||
i--;
|
goto err_free;
|
||||||
break;
|
|
||||||
}
|
|
||||||
memset(txb->fragments[i]->cb, 0, sizeof(txb->fragments[i]->cb));
|
memset(txb->fragments[i]->cb, 0, sizeof(txb->fragments[i]->cb));
|
||||||
}
|
}
|
||||||
if (unlikely(i != nr_frags)) {
|
|
||||||
while (i >= 0)
|
|
||||||
dev_kfree_skb_any(txb->fragments[i--]);
|
|
||||||
kfree(txb);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return txb;
|
return txb;
|
||||||
|
|
||||||
|
err_free:
|
||||||
|
while (--i >= 0)
|
||||||
|
dev_kfree_skb_any(txb->fragments[i]);
|
||||||
|
kfree(txb);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rtllib_classify(struct sk_buff *skb, u8 bIsAmsdu)
|
static int rtllib_classify(struct sk_buff *skb, u8 bIsAmsdu)
|
||||||
|
|
Loading…
Reference in New Issue