* [PATCH] UBI: Return -ENOMEM upon failing malloc
@ 2008-12-10 9:42 Stefan Roese
2008-12-10 10:54 ` Artem Bityutskiy
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Roese @ 2008-12-10 9:42 UTC (permalink / raw)
To: linux-mtd
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] UBI: Return -ENOMEM upon failing malloc
2008-12-10 9:42 [PATCH] UBI: Return -ENOMEM upon failing malloc Stefan Roese
@ 2008-12-10 10:54 ` Artem Bityutskiy
0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2008-12-10 10:54 UTC (permalink / raw)
To: Stefan Roese; +Cc: linux-mtd
On Wed, 2008-12-10 at 10:42 +0100, Stefan Roese wrote:
> 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(-)
Thanks for the patch. I've improved it a little bit and pushed:
http://git.infradead.org/users/dedekind/ubi-2.6.git?a=commit;h=ad5942bad6addcf9697a74413b517d9724d803a4
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-12-10 10:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-10 9:42 [PATCH] UBI: Return -ENOMEM upon failing malloc Stefan Roese
2008-12-10 10:54 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox