mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: devel@driverdev.osuosl.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Maciek Borzecki <maciek.borzecki@gmail.com>,
	Simo Koskinen <koskisoft@gmail.com>,
	Thibaut Sautereau <thibaut.sautereau@telecom-sudparis.eu>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 4/4] staging/wlan-ng/prism2fw: Use common error handling code in writeimage()
Date: Wed, 13 Dec 2017 14:14:26 +0100	[thread overview]
Message-ID: <73da6cfc-5534-556d-3d3c-542cc31e8eef@users.sourceforge.net> (raw)
In-Reply-To: <3599ae76-1aa8-4b6a-bf31-90e467759629@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 13 Dec 2017 13:41:41 +0100

Replace two calls of the function "kfree" by a jump to the same statements
at the end of this function so that the generated object code could become
a bit smaller.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/staging/wlan-ng/prism2fw.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wlan-ng/prism2fw.c b/drivers/staging/wlan-ng/prism2fw.c
index e6f7ed17106a..42ad5ff7772e 100644
--- a/drivers/staging/wlan-ng/prism2fw.c
+++ b/drivers/staging/wlan-ng/prism2fw.c
@@ -1012,9 +1012,8 @@ static int writeimage(struct wlandevice *wlandev, struct imgchunk *fchunk,
 	rstmsg = kzalloc(sizeof(*rstmsg), GFP_KERNEL);
 	rwrmsg = kzalloc(sizeof(*rwrmsg), GFP_KERNEL);
 	if (!rstmsg || !rwrmsg) {
-		kfree(rstmsg);
-		kfree(rwrmsg);
-		return -ENOMEM;
+		result = -ENOMEM;
+		goto free_result;
 	}
 
 	/* Initialize the messages */
-- 
2.15.1

      parent reply	other threads:[~2017-12-13 13:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-13 13:10 [PATCH 0/4] staging/wlan-ng/prism2fw: Adjustments for two function implementations SF Markus Elfring
2017-12-13 13:11 ` [PATCH 1/4] staging/wlan-ng/prism2fw: Delete an error message for a failed memory allocation in mkimage() SF Markus Elfring
2017-12-13 13:12 ` [PATCH 2/4] staging/wlan-ng/prism2fw: Use a known error code after a failed kzalloc() " SF Markus Elfring
2017-12-13 13:13 ` [PATCH 3/4] staging/wlan-ng/prism2fw: Delete an error message for a failed memory allocation in writeimage() SF Markus Elfring
2017-12-13 13:14 ` SF Markus Elfring [this message]

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=73da6cfc-5534-556d-3d3c-542cc31e8eef@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=koskisoft@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciek.borzecki@gmail.com \
    --cc=thibaut.sautereau@telecom-sudparis.eu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®