diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2010-01-12 10:26:42 (GMT) |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2010-02-01 13:16:36 (GMT) |
commit | 0bf1c4399afee6a2031b0ee943a4c016e53f727c (patch) | |
tree | c5d7a62b2c965e65a42f17f6206c28f3c4e57a81 /fs/internal.h | |
parent | f9b0080e10e0ce3b8acbe91ae6a50da4f2ed7339 (diff) | |
download | linux-fsl-qoriq-0bf1c4399afee6a2031b0ee943a4c016e53f727c.tar.xz |
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>
Diffstat (limited to 'fs/internal.h')
0 files changed, 0 insertions, 0 deletions