public inbox for linux-kernel@vger.kernel.org
 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 2/4] staging/wlan-ng/prism2fw: Use a known error code after a failed kzalloc() in mkimage()
Date: Wed, 13 Dec 2017 14:12:41 +0100	[thread overview]
Message-ID: <e4ea47b6-ba6d-1b6e-0d51-e5fcceca27d0@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:20:10 +0100

Make a memory allocation failure clearer by using the error code "-ENOMEM"
(instead of the constant "1") in this function.

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

diff --git a/drivers/staging/wlan-ng/prism2fw.c b/drivers/staging/wlan-ng/prism2fw.c
index 6888d1b093fa..efca9108dad8 100644
--- a/drivers/staging/wlan-ng/prism2fw.c
+++ b/drivers/staging/wlan-ng/prism2fw.c
@@ -558,7 +558,7 @@ static int mkimage(struct imgchunk *clist, unsigned int *ccnt)
 	for (i = 0; i < *ccnt; i++) {
 		clist[i].data = kzalloc(clist[i].len, GFP_KERNEL);
 		if (!clist[i].data)
-			return 1;
+			return -ENOMEM;
 
 		pr_debug("chunk[%d]: addr=0x%06x len=%d\n",
 			 i, clist[i].addr, clist[i].len);
-- 
2.15.1

  parent reply	other threads:[~2017-12-13 13:12 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 ` SF Markus Elfring [this message]
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 ` [PATCH 4/4] staging/wlan-ng/prism2fw: Use common error handling code " SF Markus Elfring

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=e4ea47b6-ba6d-1b6e-0d51-e5fcceca27d0@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