mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Xavier Douville <barebox@douville.org>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: [PATCH] Do not print error message when successfully attaching more than one UBI device
Date: Tue, 12 Feb 2013 10:31:23 -0500	[thread overview]
Message-ID: <20130212153132.XAZZ26520.toroondcbmts05-srv.bellnexxia.net@toip34-bus.srvr.bell.ca> (raw)
In-Reply-To: <20130211091905.GQ1906@pengutronix.de>

Hi

This patch fix a bug where an error message is printed when 
attaching more than one UBI device. ubi_attach_mtd_dev() returns
the UBI device number (>=0) on success.

Signed-off-by: Xavier Douville <barebox@douville.org>
---
 commands/ubi.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/commands/ubi.c b/commands/ubi.c
index 1653eaa..8dc95ee 100644
--- a/commands/ubi.c
+++ b/commands/ubi.c
@@ -71,15 +71,19 @@ static int do_ubiattach(int argc, char *argv[])
 	}
 
 	ret = ioctl(fd, MEMGETINFO, &user);
-	if (!ret)
+	if (!ret) {
 		ret = ubi_attach_mtd_dev(user.mtd, UBI_DEV_NUM_AUTO, 0);
+		if (ret >= 0) {
+			close(fd);
+			return 0;
+		}
+	}
 
-	if (ret)
-		printf("failed to attach: %s\n", strerror(-ret));
+	printf("failed to attach: %s\n", strerror(ret));
 
 	close(fd);
 
-	return ret ? 1 : 0;
+	return 1;
 }
 
 static const __maybe_unused char cmd_ubiattach_help[] =
-- 
1.7.9.5

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      parent reply	other threads:[~2013-02-12 15:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-08 20:01 [PATCH 1/1] commands/ubi.c: Add support for VID header offset in ubiattach Xavier Douville
2013-02-11  9:19 ` Sascha Hauer
2013-02-11 15:14   ` Xavier Douville
2013-02-11 15:21     ` Sascha Hauer
2013-02-14 16:23       ` Jan Lübbe
2013-02-15 15:54         ` Xavier Douville
2013-02-15 16:06           ` Jan Lübbe
2013-02-15 16:58             ` Xavier Douville
2013-02-12 22:49     ` Marc Kleine-Budde
2013-02-12 22:52       ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-13  9:00         ` Marc Kleine-Budde
2013-02-12 15:31   ` Xavier Douville [this message]

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=20130212153132.XAZZ26520.toroondcbmts05-srv.bellnexxia.net@toip34-bus.srvr.bell.ca \
    --to=barebox@douville.org \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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