From: Felix Schlepper <f3sch.git@outlook.com>
To: gregkh@linuxfoundation.org
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH v3 3/3] Staging: rtl8192e: Cleaning up error handling
Date: Wed, 22 Jun 2022 17:12:46 +0200 [thread overview]
Message-ID: <AM9P190MB1299C167B21A1FAA157AF1C7A5B29@AM9P190MB1299.EURP190.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <cover.1655909205.git.f3sch.git@outlook.com>
This error handling is more readable and reduces code size.
Signed-off-by: Felix Schlepper <f3sch.git@outlook.com>
---
drivers/staging/rtl8192e/rtllib_tx.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c
index 1307cf55741a..b246f5e0cad7 100644
--- a/drivers/staging/rtl8192e/rtllib_tx.c
+++ b/drivers/staging/rtl8192e/rtllib_tx.c
@@ -214,19 +214,18 @@ static struct rtllib_txb *rtllib_alloc_txb(int nr_frags, int txb_size,
for (i = 0; i < nr_frags; i++) {
txb->fragments[i] = dev_alloc_skb(txb_size);
- if (unlikely(!txb->fragments[i])) {
- i--;
- break;
- }
+ if (unlikely(!txb->fragments[i]))
+ goto err_free;
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;
+
+err_free:
+ while (--i >= 0)
+ dev_kfree_skb_any(txb->fragments[i]);
+
+ return NULL;
}
static int rtllib_classify(struct sk_buff *skb, u8 bIsAmsdu)
--
2.36.1
next prev parent reply other threads:[~2022-06-22 15:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1655909205.git.f3sch.git@outlook.com>
2022-06-22 15:12 ` [PATCH v3 1/3] Staging: rtl8192e: Use struct_size Felix Schlepper
2022-06-22 15:12 ` [PATCH v3 2/3] Staging: rtl8192e: Using kzalloc and delete memset Felix Schlepper
2022-06-23 7:05 ` Dan Carpenter
2022-06-22 15:12 ` Felix Schlepper [this message]
2022-06-23 6:54 ` [PATCH v3 3/3] Staging: rtl8192e: Cleaning up error handling Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AM9P190MB1299C167B21A1FAA157AF1C7A5B29@AM9P190MB1299.EURP190.PROD.OUTLOOK.COM \
--to=f3sch.git@outlook.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.