From patchwork Mon Dec 18 12:51:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 850038 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:400c:c0c::238; helo=mail-wr0-x238.google.com; envelope-from=swupdate+bncbcxploxj6ikrbspt33iqkgqemd5tugi@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="BXUS6Tk3"; dkim-atps=neutral Received: from mail-wr0-x238.google.com (mail-wr0-x238.google.com [IPv6:2a00:1450:400c:c0c::238]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3z0grs5xYbz9s82 for ; Mon, 18 Dec 2017 23:51:24 +1100 (AEDT) Received: by mail-wr0-x238.google.com with SMTP id y23sf9371656wra.16 for ; Mon, 18 Dec 2017 04:51:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1513601482; cv=pass; d=google.com; s=arc-20160816; b=BEpwHNpyiquAQB6cYeEh4k1IBCjM8BtCi4xMMjj09cNbAiVdC7UHoKSu/pY4mZQxY7 7cQYUCJmT5y1F6SggMTW/lAUDYVdH/TprSYHtRnBzQ0p7+Q3s6tzENLay9g01LTnxn1x hvXEFR6sm3xR8g73YzD1HO2UPwEoNwtsF6DMXcroPY5YMzXpuf3rWsaSOPJA2voHpU5F SEdfb47lILnWPxEndLEFzI8EogrX4xDpa/tNqH3nFnWE28sQCDxldZZqpq+rVrjEvwPe tscK40wSWj6UrNeejtwywkk+V/o8EK2mPy2x+Hd1Spv0IJzPiSsicoPPbCRr3pjO4BT+ iXzw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:message-id:date:subject:cc:to:from :arc-authentication-results:arc-message-signature:mime-version :sender:dkim-signature:arc-authentication-results; bh=dlSnbyj8fwn6b7Je0bv7vFWHR3UJdVDdMyQ58QItyRo=; b=DyKEEExPAjURxGNPH9EJ+x5ohlfOLtNM/LroiyKJJHxflaZLEBFnCA+H1ENRLCirIp aEoogbKEwUuSqtq1ZHqK9kAe3FSCv9vXLY2MkglWQIlevrWmuX7wHz2H6zpfIc2SiFc0 XRisjKoIsH9bLxdXiIjfQoirhM1ioDyN3MFzK9Zq0n9i92mNPwVE7MbJfHNi7XwIGLrT +kUFU86ci+1Ns+2tIMSjSXmpmBBLfnkw+K9YK3mvbWOmBPjLwrrwp6JS2FmXdv+e3baF qgzYs8EoKDXkaqhPVRFuRXNu0yU3gECV4oG88+CZCnFoUZpDI0FZSgHXHhxbppZv7PtP 5uNA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=dlSnbyj8fwn6b7Je0bv7vFWHR3UJdVDdMyQ58QItyRo=; b=BXUS6Tk3ux41g+Ve4BhZBJAufYtCl4DV4yWmVX46TAMBEwVZjiyjBAf0iHtjZfz3lo 8ZRItrknWnWNydRg7F2ZxGlkTw0CTi7R9oixAlov8H1YIC40YK72rd+c2QTYoarGD6EO Sg5fDdHZhcm8jqMHDt3V1XRsI2Aty1asrYcaT4IcEp2YZjNnQn/hwXfvj1NcMg79JXVu EGOX9fq5j9Sg5/Rvu7RJmkzHWofks17A0IpyNG/txylVOGO8E+nJT41u/isDR9Y6DGYr sDf3lqtu2oZmURLLNfd99X338BSEHy+CLOEKZfBiJZdFL+SG0WHMlKJYTjTloesH3D8+ t5/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=dlSnbyj8fwn6b7Je0bv7vFWHR3UJdVDdMyQ58QItyRo=; b=OvwBqEsnJJkBVDXX3SmRSTdv7xn+eKMflsQeNPx/jfKuTYzqBiOsZuzNPv2ggzVJ/w H0SbjCgrYl4DSWXlygZpi0AmYH3n3LV+Gz18FZRYyC/g1/1Iy4Y91TqbPLTNvaPPp74m MjVBS54Fyu5UwVoFHVSzXR8ulcudbgVcUZOVb2feXSfJyjWdb12NzMRGoS7+YVSXT7ZB KsAJzYvjKA4/+LazYuSjtHi7P4rhzQrARbz6i/XbhBng47ay6uwuG40KRTK39X/HzTed LomLUpBdR0ZqdAgxEID/VGbGbON5bY8UBrmJGSSNeTw6TmR8pZkuRDZJaHcoe1R3mR70 +9dQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: AKGB3mKLo6VfKQW5w5Sfey1gcieRjMnmg2NdMfxlbzDg/XTPZJMbzh0u fFfGfgV4bPGNziJZwAiD6fc= X-Google-Smtp-Source: ACJfBotZDhKhIYZJ5XUb9OcNq7tP7kBW7/AHtUQ0wdufMSPP8l+ZjPXb3g9A8OyUh+t3eGEzWiycww== X-Received: by 10.28.150.80 with SMTP id y77mr129590wmd.4.1513601482228; Mon, 18 Dec 2017 04:51:22 -0800 (PST) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 10.28.170.146 with SMTP id t140ls2909210wme.9.gmail; Mon, 18 Dec 2017 04:51:21 -0800 (PST) X-Received: by 10.28.138.194 with SMTP id m185mr1578196wmd.9.1513601481522; Mon, 18 Dec 2017 04:51:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513601481; cv=none; d=google.com; s=arc-20160816; b=sz/cUNL8k/svsaamGU1FosY/FZGA800det0DJ/C8gbW2vsfbu738mdzPN9yf9GC0yJ f5G2V4matijEHn1Wb7BvJfDeoE1HR7LlVm8qAtqVL9b7w06oIv4NcLxG7vgq34JfSFFU ytPZY5mCBU7Qvw4rJQ9ZUjA9SjvhPgr6sEQJrRHG0JPkJjWVyIPmq8orAd/nCgTBivVL AXYFIfw7NyAvWOU5WTQM/4QO/zddoCAnR7PHVip4pjeePHG5oe3PAF98pmSTjY6mG7Sl gIUW/tFtpawltKyzHwdscv5lSCroEAk+BI6udFzWOoZkK0BfUqfgYZzwMfRQwIlMep/Z AbGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:arc-authentication-results; bh=oyUBSvlYTNQeElV0H66MmnxEBEAjuW60H/N6pNCJiR0=; b=K/Ghv6s5ZNPcVPINB6N9X9frP53Sxlv9pznivJQSba/P8KPWUYU5v+XlCNWGxPB7IB ZwtoTc//SEDhx/qkM6T7qhQ6nmJtbdhO3iddPRXxKHph8E+nkOeFX9vh+olZzZrzF7NT lkw9QCcaGY3HUXl1eWxLsNpEJ446Ef8e/lc1/1AVUc/RdYYJh9LciPEoYOTZluiUDd1b aVeQS6/NqM1g+VGuKw5u8sfrsnxRAtEjs6zAUel9nl2e8GLLIvbiPw3woaHBuQb5R3ra iCyBZ9782viOgyiKGEBm1r+nAX9vIrSUTFCI04TyJH1fNo/Sj3MlYs7ocNWiyYceKZw/ j8GQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.9]) by gmr-mx.google.com with ESMTPS id j81si781177wmd.1.2017.12.18.04.51.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Dec 2017 04:51:21 -0800 (PST) Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=212.18.0.9; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3z0grn2Kpsz1qrkM; Mon, 18 Dec 2017 13:51:21 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 3z0grn1x7Sz1ry0f; Mon, 18 Dec 2017 13:51:21 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id UZVpxKe_Aurh; Mon, 18 Dec 2017 13:51:20 +0100 (CET) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Mon, 18 Dec 2017 13:51:20 +0100 (CET) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 02F14454032A; Mon, 18 Dec 2017 13:51:20 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([127.0.0.1]) by localhost (mail.babic.homelinux.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eGklw5HnqT-o; Mon, 18 Dec 2017 13:51:17 +0100 (CET) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 7DE54454016E; Mon, 18 Dec 2017 13:51:17 +0100 (CET) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH] Do not skip sectors to erase if unlock is not supported Date: Mon, 18 Dec 2017 13:51:14 +0100 Message-Id: <1513601474-17574-1-git-send-email-sbabic@denx.de> X-Mailer: git-send-email 2.7.4 X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Not all flashes support lock, and mtd_is_locked() return true even if unlock is unsupported, and the sector is not erased. This generates an error later when sector is written. Check the error code and ignore it if the feature is unsupported for the MTD device to be erased. Signed-off-by: Stefano Babic --- corelib/mtd-interface.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/corelib/mtd-interface.c b/corelib/mtd-interface.c index ee7d62a..93c7215 100644 --- a/corelib/mtd-interface.c +++ b/corelib/mtd-interface.c @@ -98,8 +98,10 @@ int flash_erase(int mtdnum) /* Unlock memory if required */ if (mtd_is_locked(mtd, fd, eb)) { if (mtd_unlock(mtd, fd, eb) != 0) { - TRACE("%s: MTD unlock failure", mtd_device); - continue; + if (errno != EOPNOTSUPP) { + TRACE("%s: MTD unlock failure", mtd_device); + continue; + } } }