All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd-utils: Fix return value of ubiformat
@ 2020-06-12 18:08 Otavio Salvador
  2020-06-12 21:25 ` [OE-core] " Denys Dmytriyenko
  0 siblings, 1 reply; 5+ messages in thread
From: Otavio Salvador @ 2020-06-12 18:08 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Otavio Salvador

This changeset fixes a feature regression in ubiformat.  Older versions
of ubiformat, when invoked with a flash-image, would return 0 in the
case no error was encountered.  Upon upgrading to latest, it was
discovered that ubiformat returned 255 even without encountering an
error condition.

This changeset corrects the above issue and causes ubiformat, when given an
image file, to return 0 when no errors are detected.

Backport fix from 2.1.2

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

 ...-utils-Fix-return-value-of-ubiformat.patch | 62 +++++++++++++++++++
 meta/recipes-devtools/mtd/mtd-utils_git.bb    |  1 +
 2 files changed, 63 insertions(+)
 create mode 100644 meta/recipes-devtools/mtd/mtd-utils/0001-mtd-utils-Fix-return-value-of-ubiformat.patch

diff --git a/meta/recipes-devtools/mtd/mtd-utils/0001-mtd-utils-Fix-return-value-of-ubiformat.patch b/meta/recipes-devtools/mtd/mtd-utils/0001-mtd-utils-Fix-return-value-of-ubiformat.patch
new file mode 100644
index 0000000000..d43f7e1a7a
--- /dev/null
+++ b/meta/recipes-devtools/mtd/mtd-utils/0001-mtd-utils-Fix-return-value-of-ubiformat.patch
@@ -0,0 +1,62 @@
+From 4d19bffcfd66e25d3ee74536ae2d2da7ad52e8e2 Mon Sep 17 00:00:00 2001
+From: Barry Grussling <barry@grussling.com>
+Date: Sun, 12 Jan 2020 12:33:32 -0800
+Subject: [PATCH] mtd-utils: Fix return value of ubiformat
+Organization: O.S. Systems Software LTDA.
+
+This changeset fixes a feature regression in ubiformat.  Older versions of
+ubiformat, when invoked with a flash-image, would return 0 in the case no error
+was encountered.  Upon upgrading to latest, it was discovered that ubiformat
+returned 255 even without encountering an error condition.
+
+This changeset corrects the above issue and causes ubiformat, when given an
+image file, to return 0 when no errors are detected.
+
+Tested by running through my loading scripts and verifying ubiformat returned
+0.
+
+Upstream-Status: Backport [2.1.2]
+
+Signed-off-by: Barry Grussling <barry@grussling.com>
+Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
+Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
+---
+ ubi-utils/ubiformat.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/ubi-utils/ubiformat.c b/ubi-utils/ubiformat.c
+index a90627c..5377b12 100644
+--- a/ubi-utils/ubiformat.c
++++ b/ubi-utils/ubiformat.c
+@@ -550,6 +550,7 @@ static int format(libmtd_t libmtd, const struct mtd_dev_info *mtd,
+ 	struct ubi_vtbl_record *vtbl;
+ 	int eb1 = -1, eb2 = -1;
+ 	long long ec1 = -1, ec2 = -1;
++	int ret = -1;
+ 
+ 	write_size = UBI_EC_HDR_SIZE + mtd->subpage_size - 1;
+ 	write_size /= mtd->subpage_size;
+@@ -643,8 +644,10 @@ static int format(libmtd_t libmtd, const struct mtd_dev_info *mtd,
+ 	if (!args.quiet && !args.verbose)
+ 		printf("\n");
+ 
+-	if (novtbl)
++	if (novtbl) {
++		ret = 0;
+ 		goto out_free;
++	}
+ 
+ 	if (eb1 == -1 || eb2 == -1) {
+ 		errmsg("no eraseblocks for volume table");
+@@ -669,7 +672,7 @@ static int format(libmtd_t libmtd, const struct mtd_dev_info *mtd,
+ 
+ out_free:
+ 	free(hdr);
+-	return -1;
++	return ret;
+ }
+ 
+ int main(int argc, char * const argv[])
+-- 
+2.27.0
+
diff --git a/meta/recipes-devtools/mtd/mtd-utils_git.bb b/meta/recipes-devtools/mtd/mtd-utils_git.bb
index 810fe40f4e..a13240d61c 100644
--- a/meta/recipes-devtools/mtd/mtd-utils_git.bb
+++ b/meta/recipes-devtools/mtd/mtd-utils_git.bb
@@ -15,6 +15,7 @@ PV = "2.1.1"
 SRCREV = "4443221ce9b88440cd9f5bb78e6fe95621d36c8a"
 SRC_URI = "git://git.infradead.org/mtd-utils.git \
            file://add-exclusion-to-mkfs-jffs2-git-2.patch \
+           file://mtd-utils-Fix-return-value-of-ubiformat.patch \
 "
 
 S = "${WORKDIR}/git/"
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [OE-core] [PATCH] mtd-utils: Fix return value of ubiformat
  2020-06-12 18:08 [PATCH] mtd-utils: Fix return value of ubiformat Otavio Salvador
@ 2020-06-12 21:25 ` Denys Dmytriyenko
  2020-06-12 21:38   ` Otavio Salvador
  0 siblings, 1 reply; 5+ messages in thread
From: Denys Dmytriyenko @ 2020-06-12 21:25 UTC (permalink / raw)
  To: Otavio Salvador; +Cc: OpenEmbedded Core Mailing List, Otavio Salvador

On Fri, Jun 12, 2020 at 03:08:09PM -0300, Otavio Salvador wrote:
> This changeset fixes a feature regression in ubiformat.  Older versions
> of ubiformat, when invoked with a flash-image, would return 0 in the
> case no error was encountered.  Upon upgrading to latest, it was
> discovered that ubiformat returned 255 even without encountering an
> error condition.
> 
> This changeset corrects the above issue and causes ubiformat, when given an
> image file, to return 0 when no errors are detected.
> 
> Backport fix from 2.1.2
> 
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> ---
> 
>  ...-utils-Fix-return-value-of-ubiformat.patch | 62 +++++++++++++++++++
>  meta/recipes-devtools/mtd/mtd-utils_git.bb    |  1 +
>  2 files changed, 63 insertions(+)
>  create mode 100644 meta/recipes-devtools/mtd/mtd-utils/0001-mtd-utils-Fix-return-value-of-ubiformat.patch

^^^

> diff --git a/meta/recipes-devtools/mtd/mtd-utils_git.bb b/meta/recipes-devtools/mtd/mtd-utils_git.bb
> index 810fe40f4e..a13240d61c 100644
> --- a/meta/recipes-devtools/mtd/mtd-utils_git.bb
> +++ b/meta/recipes-devtools/mtd/mtd-utils_git.bb
> @@ -15,6 +15,7 @@ PV = "2.1.1"
>  SRCREV = "4443221ce9b88440cd9f5bb78e6fe95621d36c8a"
>  SRC_URI = "git://git.infradead.org/mtd-utils.git \
>             file://add-exclusion-to-mkfs-jffs2-git-2.patch \
> +           file://mtd-utils-Fix-return-value-of-ubiformat.patch \

^^^
Was it tested? The patch name doesn't seem to match the file name.

-- 
Denys

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [OE-core] [PATCH] mtd-utils: Fix return value of ubiformat
  2020-06-12 21:25 ` [OE-core] " Denys Dmytriyenko
@ 2020-06-12 21:38   ` Otavio Salvador
  0 siblings, 0 replies; 5+ messages in thread
From: Otavio Salvador @ 2020-06-12 21:38 UTC (permalink / raw)
  To: Denys Dmytriyenko; +Cc: OpenEmbedded Core Mailing List, Otavio Salvador

Em sex., 12 de jun. de 2020 às 18:25, Denys Dmytriyenko
<denis@denix.org> escreveu:
>
> On Fri, Jun 12, 2020 at 03:08:09PM -0300, Otavio Salvador wrote:
> > This changeset fixes a feature regression in ubiformat.  Older versions
> > of ubiformat, when invoked with a flash-image, would return 0 in the
> > case no error was encountered.  Upon upgrading to latest, it was
> > discovered that ubiformat returned 255 even without encountering an
> > error condition.
> >
> > This changeset corrects the above issue and causes ubiformat, when given an
> > image file, to return 0 when no errors are detected.
> >
> > Backport fix from 2.1.2
> >
> > Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> > ---
> >
> >  ...-utils-Fix-return-value-of-ubiformat.patch | 62 +++++++++++++++++++
> >  meta/recipes-devtools/mtd/mtd-utils_git.bb    |  1 +
> >  2 files changed, 63 insertions(+)
> >  create mode 100644 meta/recipes-devtools/mtd/mtd-utils/0001-mtd-utils-Fix-return-value-of-ubiformat.patch
>
> ^^^
...
> ^^^
> Was it tested? The patch name doesn't seem to match the file name.

It was, but I sent it before the git commit --amend. Sorry.

Will send the v2.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9 9981-7854          Mobile: +1 (347) 903-9750

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mtd-utils: Fix return value of ubiformat
  2020-01-12 20:33 Barry Grussling
@ 2020-01-13  9:41 ` David Oberhollenzer
  0 siblings, 0 replies; 5+ messages in thread
From: David Oberhollenzer @ 2020-01-13  9:41 UTC (permalink / raw)
  To: Barry Grussling, linux-mtd

Applied to mtd-utils.git master.

Thanks,

David

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] mtd-utils: Fix return value of ubiformat
@ 2020-01-12 20:33 Barry Grussling
  2020-01-13  9:41 ` David Oberhollenzer
  0 siblings, 1 reply; 5+ messages in thread
From: Barry Grussling @ 2020-01-12 20:33 UTC (permalink / raw)
  To: linux-mtd

This changeset fixes a feature regression in ubiformat.  Older versions of
ubiformat, when invoked with a flash-image, would return 0 in the case no error
was encountered.  Upon upgrading to latest, it was discovered that ubiformat
returned 255 even without encountering an error condition.

This changeset corrects the above issue and causes ubiformat, when given an
image file, to return 0 when no errors are detected.

Tested by running through my loading scripts and verifying ubiformat returned
0.

Signed-off-by: Barry Grussling <barry@grussling.com>
---
 ubi-utils/ubiformat.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/ubi-utils/ubiformat.c b/ubi-utils/ubiformat.c
index 64afad2..be40e52 100644
--- a/ubi-utils/ubiformat.c
+++ b/ubi-utils/ubiformat.c
@@ -550,6 +550,7 @@ static int format(libmtd_t libmtd, const struct mtd_dev_info *mtd,
 	struct ubi_vtbl_record *vtbl;
 	int eb1 = -1, eb2 = -1;
 	long long ec1 = -1, ec2 = -1;
+	int ret = -1;
 
 	write_size = UBI_EC_HDR_SIZE + mtd->subpage_size - 1;
 	write_size /= mtd->subpage_size;
@@ -643,8 +644,10 @@ static int format(libmtd_t libmtd, const struct mtd_dev_info *mtd,
 	if (!args.quiet && !args.verbose)
 		printf("\n");
 
-	if (novtbl)
+	if (novtbl) {
+		ret = 0;
 		goto out_free;
+	}
 
 	if (eb1 == -1 || eb2 == -1) {
 		errmsg("no eraseblocks for volume table");
@@ -669,7 +672,7 @@ static int format(libmtd_t libmtd, const struct mtd_dev_info *mtd,
 
 out_free:
 	free(hdr);
-	return -1;
+	return ret;
 }
 
 int main(int argc, char * const argv[])
-- 
2.24.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-06-12 21:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-12 18:08 [PATCH] mtd-utils: Fix return value of ubiformat Otavio Salvador
2020-06-12 21:25 ` [OE-core] " Denys Dmytriyenko
2020-06-12 21:38   ` Otavio Salvador
  -- strict thread matches above, loose matches on Subject: below --
2020-01-12 20:33 Barry Grussling
2020-01-13  9:41 ` David Oberhollenzer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.