linux/drivers/mtd/ubi
Artem Bityutskiy 0bf1c4399a UBI: fix attaching error path
In the error path of 'ubi_attach_mtd_dev()' we have a tricky situation:
we have to release things differently depending on at which point
the failure happening. Namely, if @ubi->dev is not initialized, we have
to free everything ourselves. But if it was, we should not free the @ubi
object, because it will be freed in the 'dev_release()' function. And
we did not get this situation right.

This patch introduces additional argument to the 'uif_init()' function.
On exit, this argument indicates whether the final 'free(ubi)' will
happen in 'dev_release()' or not. So the caller always knows how to
properly release the resources.

Impact: all memory is now correctly released when UBI fails to attach
        an MTD device.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-02-01 15:16:36 +02:00
..
build.c UBI: fix attaching error path 2010-02-01 15:16:36 +02:00
cdev.c UBI: fix volume creation input checking 2010-01-27 11:55:43 +02:00
debug.c UBI: introduce flash dump helper 2009-08-14 20:02:20 +03:00
debug.h UBI: introduce flash dump helper 2009-08-14 20:02:20 +03:00
eba.c trivial: fix typo "to to" in multiple files 2009-09-21 15:14:55 +02:00
gluebi.c UBI: gluebi: initialize ubi_num field 2009-07-15 11:30:55 +03:00
io.c UBI: improve NOR flash erasure quirk 2009-08-14 20:02:20 +03:00
kapi.c UBI: add more checks to chdev open 2010-01-12 13:19:15 +02:00
Kconfig Kconfig: Remove useless and sometimes wrong comments 2009-11-09 09:40:56 +01:00
Kconfig.debug UBI: allow direct user-space I/O 2009-01-27 16:54:41 +02:00
Makefile UBI: make gluebi a separate module 2009-06-03 17:45:23 +03:00
misc.c UBI: avoid unnecessary division operations 2008-07-24 13:32:54 +03:00
scan.c UBI: fix backward compatibility 2009-10-20 10:13:04 +03:00
scan.h UBI: fix backward compatibility 2009-10-20 10:13:04 +03:00
ubi-media.h UBI: add image sequence number to EC header 2009-07-05 18:47:07 +03:00
ubi.h Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2009-09-22 07:51:45 -07:00
upd.c UBI: fix memory leak in update path 2010-01-18 18:53:56 +02:00
vmt.c UBI: remove built-in gluebi 2009-06-02 13:53:35 +03:00
vtbl.c UBI: initialise update marker 2010-01-12 13:19:08 +02:00
wl.c UBI: remove bogus debugging checks 2009-07-05 18:47:05 +03:00