From: Stefan Roese <sr@denx.de>
To: linux-mtd@lists.infradead.org
Subject: [PATCH] UBI: Return -ENOMEM upon failing malloc
Date: Wed, 10 Dec 2008 10:42:54 +0100 [thread overview]
Message-ID: <1228902174-24597-1-git-send-email-sr@denx.de> (raw)
Return with correct error code (-ENOMEM) from ubi_attach_mtd_dev() upon
failing malloc().
Signed-off-by: Stefan Roese <sr@denx.de>
---
drivers/mtd/ubi/build.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index c7630a2..485c0fc 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -816,18 +816,24 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset)
goto out_free;
ubi->peb_buf1 = vmalloc(ubi->peb_size);
- if (!ubi->peb_buf1)
+ if (!ubi->peb_buf1) {
+ err = -ENOMEM;
goto out_free;
+ }
ubi->peb_buf2 = vmalloc(ubi->peb_size);
- if (!ubi->peb_buf2)
- goto out_free;
+ if (!ubi->peb_buf2) {
+ err = -ENOMEM;
+ goto out_free;
+ }
#ifdef CONFIG_MTD_UBI_DEBUG
mutex_init(&ubi->dbg_buf_mutex);
ubi->dbg_peb_buf = vmalloc(ubi->peb_size);
- if (!ubi->dbg_peb_buf)
- goto out_free;
+ if (!ubi->dbg_peb_buf) {
+ err = -ENOMEM;
+ goto out_free;
+ }
#endif
err = attach_by_scanning(ubi);
--
1.6.0.5
next reply other threads:[~2008-12-10 9:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-10 9:42 Stefan Roese [this message]
2008-12-10 10:54 ` [PATCH] UBI: Return -ENOMEM upon failing malloc Artem Bityutskiy
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=1228902174-24597-1-git-send-email-sr@denx.de \
--to=sr@denx.de \
--cc=linux-mtd@lists.infradead.org \
/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