public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: xiaolei li <xiaolei.li@mediatek.com>
To: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Cc: <linux-mtd@lists.infradead.org>, <Chris.Packham@alliedtelesis.co.nz>
Subject: Re: [PATCH] libmtd: don't print an error message for devices without ecc support
Date: Thu, 20 Sep 2018 08:59:56 +0800	[thread overview]
Message-ID: <1537405196.10234.22.camel@mhfsdcap03> (raw)
In-Reply-To: <20180919082936.4011-1-david.oberhollenzer@sigma-star.at>

Hi David,

Thanks.

Reviewed-by: Xiaolei Li <xiaolei.li@mediatek.com>

On Wed, 2018-09-19 at 10:29 +0200, David Oberhollenzer wrote:
> 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>
> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
> ---
>  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;
>  	}

  parent reply	other threads:[~2018-09-20  1:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-19  8:29 [PATCH] libmtd: don't print an error message for devices without ecc support David Oberhollenzer
2018-09-19 21:45 ` Chris Packham
2018-09-20  0:59 ` xiaolei li [this message]
2018-10-02 12:06 ` David Oberhollenzer

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=1537405196.10234.22.camel@mhfsdcap03 \
    --to=xiaolei.li@mediatek.com \
    --cc=Chris.Packham@alliedtelesis.co.nz \
    --cc=david.oberhollenzer@sigma-star.at \
    --cc=linux-mtd@lists.infradead.org \
    /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