Patchwork ubiformat: fix error path

login
register
mail settings
Submitter Wolfram Sang
Date Dec. 13, 2012, 4:41 p.m.
Message ID <1355416874-23907-1-git-send-email-w.sang@pengutronix.de>
Download mbox | patch
Permalink /patch/206162/
State New
Headers show

Comments

Wolfram Sang - Dec. 13, 2012, 4:41 p.m.
A few error paths were closing the device, although it was not opened
yet.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
---
 ubi-utils/ubiformat.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Artem Bityutskiy - Jan. 15, 2013, 8:38 a.m.
On Thu, 2012-12-13 at 17:41 +0100, Wolfram Sang wrote:
> A few error paths were closing the device, although it was not opened
> yet.
> 
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>

Pushed to mtd-utils, thanks!

Patch

diff --git a/ubi-utils/ubiformat.c b/ubi-utils/ubiformat.c
index c49af29..899f9fc 100644
--- a/ubi-utils/ubiformat.c
+++ b/ubi-utils/ubiformat.c
@@ -740,7 +740,7 @@  int main(int argc, char * const argv[])
 	if (!is_power_of_2(mtd.min_io_size)) {
 		errmsg("min. I/O size is %d, but should be power of 2",
 		       mtd.min_io_size);
-		goto out_close;
+		goto out_close_mtd;
 	}
 
 	if (!mtd_info.sysfs_supported) {
@@ -768,13 +768,13 @@  int main(int argc, char * const argv[])
 		/* Do some sanity check */
 		if (args.subpage_size > mtd.min_io_size) {
 			errmsg("sub-page cannot be larger than min. I/O unit");
-			goto out_close;
+			goto out_close_mtd;
 		}
 
 		if (mtd.min_io_size % args.subpage_size) {
 			errmsg("min. I/O unit size should be multiple of "
 			       "sub-page size");
-			goto out_close;
+			goto out_close_mtd;
 		}
 	}