[PATCH 4/4] staging/wlan-ng/prism2fw: Use common error handling code in writeimage()

SF Markus Elfring elfring at users.sourceforge.net
Wed Dec 13 13:14:26 UTC 2017


From: Markus Elfring <elfring at 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 at 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



More information about the devel mailing list