From patchwork Wed Sep 19 08:29:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Oberhollenzer X-Patchwork-Id: 971496 X-Patchwork-Delegate: david.oberhollenzer@sigma-star.at Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sigma-star.at Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bmAFU6Zb"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42FY3l5J6fz9sCS for ; Wed, 19 Sep 2018 18:31:15 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=Go4AdxeCPurS39CHoDUBi1C0mpTG8o6is4My6DckoBY=; b=bmA FU6ZbfJKEI5s0hxM6Tzykq510h8+WQu8z2UY9DzXLsLywcZPfNi0joKy5uuokXw4Cd0QS+JWyDZ9I q73DEtI75yvXRobCa2cHFppQwEK53gARKQKpptcoXigZRmOrdH/B9K0daj16Sk0hMvQZKawDPTTZK zl/U+At2UmnzeRgkmcnpAdSPEvpTP4dfTRgs67Zb/4O7AFSzW0Cdi9nFjelztVPzSvnfS0d/B/sAK K6e2iqdpr9Q6RnGXXKpPeP5iLYK7Am17jYDZSdWUaF9zJwcTz637yVjy2F1TU4ek0sf1o5ic4QTiD 7ssknsHBcVBsKgEjauG8WyqRQoifn5A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g2Xsy-0003x0-IZ; Wed, 19 Sep 2018 08:31:00 +0000 Received: from lilium.sigma-star.at ([109.75.188.150]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g2Xsu-0003uw-D3 for linux-mtd@lists.infradead.org; Wed, 19 Sep 2018 08:30:58 +0000 Received: from localhost (localhost [127.0.0.1]) by lilium.sigma-star.at (Postfix) with ESMTP id 430F618023C5B; Wed, 19 Sep 2018 10:30:42 +0200 (CEST) From: David Oberhollenzer To: linux-mtd@lists.infradead.org Subject: [PATCH] libmtd: don't print an error message for devices without ecc support Date: Wed, 19 Sep 2018 10:29:36 +0200 Message-Id: <20180919082936.4011-1-david.oberhollenzer@sigma-star.at> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180919_013056_588532_372BD856 X-CRM114-Status: GOOD ( 13.09 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 T_SPF_PERMERROR SPF: test of record failed (permerror) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: xiaolei.li@mediatek.com, Chris.Packham@alliedtelesis.co.nz, David Oberhollenzer MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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 Signed-off-by: David Oberhollenzer Tested-by: Chris Packham Reviewed-by: Xiaolei Li --- 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; }