All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/mtd: backport patch to remove errors for devices without ecc support
@ 2019-03-27 14:01 Thomas De Schampheleire
  2019-03-27 14:11 ` Baruch Siach
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas De Schampheleire @ 2019-03-27 14:01 UTC (permalink / raw)
  To: buildroot

From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

Since the introduction of mtd-utils 2.0.2, following error can appear on
e.g. flash_erase calls:

    libmtd: error!: ECCGETLAYOUT ioctl request failed
            error 122 (Operation not supported)

The error should only be printed if there was an actual error in the
ECCGETLAYOUT ioctl call, not when the ioctl is not supported.

Backport an upstream patch that fixes this issue.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---
 ...nt-an-error-message-for-devices-with.patch | 43 +++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 package/mtd/0002-libmtd-don-t-print-an-error-message-for-devices-with.patch

diff --git a/package/mtd/0002-libmtd-don-t-print-an-error-message-for-devices-with.patch b/package/mtd/0002-libmtd-don-t-print-an-error-message-for-devices-with.patch
new file mode 100644
index 0000000000..55de2bf0a8
--- /dev/null
+++ b/package/mtd/0002-libmtd-don-t-print-an-error-message-for-devices-with.patch
@@ -0,0 +1,43 @@
+From a63a209d8ee8f21722a3b07d01d904bca5dbbc31 Mon Sep 17 00:00:00 2001
+From: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
+Date: Wed, 12 Sep 2018 09:40:34 +0200
+Subject: [PATCH] libmtd: don't print an error message for devices without ecc
+ support
+
+The libmtd library tries to obtain the available OOB size via the sysfs
+with a fallback to the ECCGETLAYOUT ioctl. For some devices (e.g. plat-ram),
+the fallback path is always taken and prints an error message to stderr
+since the ioctl fails.
+
+This patch fixes the fallback path by suppressing the error message if
+errno is set to EOPNOTSUPP (i.e. the device simply doesn't support that).
+
+Fixes: a10353584f93 ("libmtd: Add support to access OOB available size")
+Reported-by: Chris Packham <Chris.Packham@alliedtelesis.co.nz>
+Reviewed-by: Xiaolei Li <xiaolei.li@mediatek.com>
+Tested-by: Chris Packham <Chris.Packham@alliedtelesis.co.nz>
+Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
+[For inclusion in Buildroot:]
+Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
+
+
+---
+ lib/libmtd_legacy.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/lib/libmtd_legacy.c b/lib/libmtd_legacy.c
+index 97fef04..2b7f65f 100644
+--- a/lib/libmtd_legacy.c
++++ b/lib/libmtd_legacy.c
+@@ -235,6 +235,8 @@ int legacy_get_mtd_oobavail(const char *node)
+ 
+ 	ret = ioctl(fd, ECCGETLAYOUT, &usrlay);
+ 	if (ret < 0) {
++		if (errno == EOPNOTSUPP)
++			goto out_close;
+ 		sys_errmsg("ECCGETLAYOUT ioctl request failed");
+ 		goto out_close;
+ 	}
+-- 
+2.19.2
+
-- 
2.19.2

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

* [Buildroot] [PATCH] package/mtd: backport patch to remove errors for devices without ecc support
  2019-03-27 14:01 [Buildroot] [PATCH] package/mtd: backport patch to remove errors for devices without ecc support Thomas De Schampheleire
@ 2019-03-27 14:11 ` Baruch Siach
  2019-03-27 14:27   ` Thomas De Schampheleire
  0 siblings, 1 reply; 3+ messages in thread
From: Baruch Siach @ 2019-03-27 14:11 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

On Wed, Mar 27, 2019 at 03:01:53PM +0100, Thomas De Schampheleire wrote:
> From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> 
> Since the introduction of mtd-utils 2.0.2, following error can appear on
> e.g. flash_erase calls:
> 
>     libmtd: error!: ECCGETLAYOUT ioctl request failed
>             error 122 (Operation not supported)
> 
> The error should only be printed if there was an actual error in the
> ECCGETLAYOUT ioctl call, not when the ioctl is not supported.
> 
> Backport an upstream patch that fixes this issue.

Why not bump to 2.1.0 instead?

baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

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

* [Buildroot] [PATCH] package/mtd: backport patch to remove errors for devices without ecc support
  2019-03-27 14:11 ` Baruch Siach
@ 2019-03-27 14:27   ` Thomas De Schampheleire
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas De Schampheleire @ 2019-03-27 14:27 UTC (permalink / raw)
  To: buildroot

El mi?., 27 mar. 2019 a las 15:11, Baruch Siach (<baruch@tkos.co.il>) escribi?:
>
> Hi Thomas,
>
> On Wed, Mar 27, 2019 at 03:01:53PM +0100, Thomas De Schampheleire wrote:
> > From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> >
> > Since the introduction of mtd-utils 2.0.2, following error can appear on
> > e.g. flash_erase calls:
> >
> >     libmtd: error!: ECCGETLAYOUT ioctl request failed
> >             error 122 (Operation not supported)
> >
> > The error should only be printed if there was an actual error in the
> > ECCGETLAYOUT ioctl call, not when the ioctl is not supported.
> >
> > Backport an upstream patch that fixes this issue.
>
> Why not bump to 2.1.0 instead?
>

Ah, because at the time I wrote this patch, it was not yet released :-)

But yes, that would be the logical thing to do...

/Thomas

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

end of thread, other threads:[~2019-03-27 14:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-27 14:01 [Buildroot] [PATCH] package/mtd: backport patch to remove errors for devices without ecc support Thomas De Schampheleire
2019-03-27 14:11 ` Baruch Siach
2019-03-27 14:27   ` Thomas De Schampheleire

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.