From patchwork Mon Oct 24 07:30:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: 'Krzysztof Kozlowski' via Amarula Linux X-Patchwork-Id: 2457 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 976F244AEE for ; Mon, 24 Oct 2022 09:30:15 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id m7-20020a056402430700b0045daff6ee5dsf8643877edc.10 for ; Mon, 24 Oct 2022 00:30:15 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1666596615; cv=pass; d=google.com; s=arc-20160816; b=KgQ6nmYDRhxU5K+WY1Ibp12873solPwrH2bpJCXg6bbCX4jqbNzKHVnkm0imVDxRYb EVc/BdYK9uEWDqJtcURx0tWIgyoLQXq+VkcQb8Az2u3cPFjpmxq5W/xVTk4AcO49Pdhd lM6x8cApRSN8Ij7ZqBxUv103+YYd+Khj+jVYO8S1cP6gYmS4Vd6sib7A9hHpB9lIpuFj IfS7Uk9eOvK54JmPyyAzpsbrxLIZV/YnReM5rcXDKqF+N+VtVpvOsL7HBMEeDpjb6hB5 26TShsG3KxQE5+jZYzzaJHT9FgLjbN6VaUeOUEu5HovkCNt31lL+I1bOsOTjcj+4CMu2 WEyQ== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:reply-to:mime-version:subject:from:cc:to :content-language:user-agent:date:message-id:dkim-signature; bh=icco3N/u0sKbO6NqsoY2ntHHfJIUgng9qiHxlAVYX9Q=; b=l3SLORgS3Ik28VT2IvLcoxuH7CSwGrADwzUqwIuVs1lnvuyYcU+ST6GgR3YFnJvoOL AgAQLAy92SsV+FV6wV6BoLb2P24NoVuG/6xGzVvZi0ssuqVNx/ZSCgqd2NLXl10g/iVo RVCvi2gGIgfsOXDrkPRM52uX6sjqw25TVuSANGYTsAmPv2Yc7nu73JbEh8ukJNAH2Tv4 zCwbZ9mR+oAscKrr2NFJEmkxXGLKf5WP7Hw9yUWMDTb8mEVyHobchXOFvfRvy+PT/wyB 1+lhvnQLt2pJ692N3f1C4k0l7gdl91Cbm8RKsGk79kUlXeN0ml5BGOVlf4JJm7U3lQBu h3zg== ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@iopsys.eu header.s=selector1 header.b=uZQtDuEn; arc=pass (i=1 spf=pass spfdomain=iopsys.eu dkim=pass dkdomain=iopsys.eu dmarc=pass fromdomain=iopsys.eu); spf=pass (google.com: domain of mikhail.kshevetskiy@iopsys.eu designates 40.107.20.87 as permitted sender) smtp.mailfrom=mikhail.kshevetskiy@iopsys.eu; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=iopsys.eu DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:reply-to:x-original-authentication-results :x-original-sender:mime-version:subject:from:cc:to:content-language :user-agent:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=icco3N/u0sKbO6NqsoY2ntHHfJIUgng9qiHxlAVYX9Q=; b=IQ9PXYTDvxbIfNbJ6wFchuux1++ZQiXBCUEfFKat+OEA688weVkMvGlEMa1TjYLOwR 5bgNWgw0E1HOkA5XeedTzscVmkRbWH6VymTHjBq+ZLfTvNmHvSJFDqrE47QZfUDxXEHo /0FKTAzW79PFAmuPMNCr5fRUaYgqexGOv5Bx8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:mime-version :subject:from:cc:to:content-language:user-agent:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=icco3N/u0sKbO6NqsoY2ntHHfJIUgng9qiHxlAVYX9Q=; b=kNh1UAlozym4qd14Yh8jJf0L+NH1U94BTPE9KDE22u0fPA8dBXWupTZ6mtjiTLm/Ve QaYXMgO1w5jnCua9szSB5C9tvEc32FTu26eCf2rf0PkkCeTYwZcNC1/HYy8nZNXeo2c6 DXOd93H2OWd8Qa1nLjLJWa7Yl+rddd32qEvIayM/rI51FjNnf4EGvjsBp+wPXTzSFwDM otPMMob1ExWjMQJX7vKlmGMifNPASXvAkPsliZ2Ej5rb2gNCZa2jFVDEcBXc6546+ybX 01jIgjDFiNxkll/jcCzcLd8mhtT2+EygVPXHDM9cywOFov1C3X9IqeT77Z97rLOzglS2 b3+w== X-Gm-Message-State: ACrzQf1T1exspYuezHhNlvC9lURIHTU52RnKWmjggX/8d76G6OOwASm3 Fgx1OkYPBtksmQow5SF3v/w/ZE7t X-Google-Smtp-Source: AMsMyM67zSg9I6Rjcbz+GQjCeNZvhi6VgKTmqO6lyBqvagVvcqdwHo3AK5LYAhfBeShwwwbwur/Rwg== X-Received: by 2002:aa7:d744:0:b0:45c:e353:e891 with SMTP id a4-20020aa7d744000000b0045ce353e891mr30071022eds.36.1666596615223; Mon, 24 Oct 2022 00:30:15 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:27d3:b0:457:99eb:cba9 with SMTP id c19-20020a05640227d300b0045799ebcba9ls8146638ede.0.-pod-prod-gmail; Mon, 24 Oct 2022 00:30:14 -0700 (PDT) X-Received: by 2002:a05:6402:3641:b0:45c:4231:ddcc with SMTP id em1-20020a056402364100b0045c4231ddccmr29146194edb.224.1666596614225; Mon, 24 Oct 2022 00:30:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1666596614; cv=pass; d=google.com; s=arc-20160816; b=j6PmLcNF10m29j2YxvMNYuoe4/EuLGl44B5cnjMS+zLZJGh7GpoAM+YAqcsSHB+s3+ FkYadjaONFsdkFundn/2C4BkVeKSAu8IKtGfBxIj5bLdWpH4o2Jqc/zMAOb/0d6zVHKq afSLrlo61KlKNatpO9RLXlHIhya9+XMWhLANrOswYxUDqahgwkO+cW1A3TbgneAt6lj9 HxdeP0VlzgVpCn+2nE2e8cKnC//j94oRDJrioLT/tx7gjgQSYlXMH5hc3046qlnQlGFh HAM2zEblTGmGo3UsfvmdEew/4QaDsUTjFG+lemQsevMt/cGmDtwaXi9jIO9IXpDIeTPk QB6Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:subject:from:cc:to:content-language:user-agent:date :message-id:dkim-signature; bh=p1oJnnzrDKDa8osgGejfHeExRsNfhxJzdY+IIE9qV8w=; b=pHGIQ3nAPfe9dGwLPk3F41DT1dPMubJ9x01EwuDM1G89jcsbEyoVfWW+8EUDVPPqBe HwjdOnZS0zcqwl31jFTAmBB1I6twBqZ5s2RsIe7ISyfyo6wSUjq2BwrM/XwjTR3kZ7VR 1XbC+3u9S7rwXRcJ4ePcH3VA7iRAlhyeC4aDTfhX43NRDds+ZGXJ1EpGnc8W3Y2gd3Mx 4qmbbZJ15x1lSRxyPQrbBTuLH2IDVkjL1AGLq0n072RP003oF0qA0zc2SpXjk9hPQHrn CMjobMNwyZoblXVsASI8G5WjAxPfWJQ0LXBBPL7WlKfXZFGXMmWR8lFTd0UzKzhvM09e A9eQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@iopsys.eu header.s=selector1 header.b=uZQtDuEn; arc=pass (i=1 spf=pass spfdomain=iopsys.eu dkim=pass dkdomain=iopsys.eu dmarc=pass fromdomain=iopsys.eu); spf=pass (google.com: domain of mikhail.kshevetskiy@iopsys.eu designates 40.107.20.87 as permitted sender) smtp.mailfrom=mikhail.kshevetskiy@iopsys.eu; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=iopsys.eu Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2087.outbound.protection.outlook.com. [40.107.20.87]) by mx.google.com with ESMTPS id i12-20020a05640242cc00b0045bccc84cebsi31898419edc.71.2022.10.24.00.30.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Oct 2022 00:30:14 -0700 (PDT) Received-SPF: pass (google.com: domain of mikhail.kshevetskiy@iopsys.eu designates 40.107.20.87 as permitted sender) client-ip=40.107.20.87; ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HEv58ukhCQeHYyZUvEe+sw1EyTwV501Q1YumSFfnGPY9QpbBVNU5FFJeiUNCw2XKfRctvxLfxecYMbu1z7w6x5tAIpcbcGsv2dgKBWj7S6hmC6eNpSky/mMWtyC7knexx33rQxerwUBqZbYx7q0rIV26QwEwEYPFFzDkVSv4PvzUTAhi/vrdamyRoTOeJjfvig13pskknmMzaqxRP0acF4LqYgy4pqJJHvMXoDm1RVSGGnFhA8DWSQfywhe9zH7QZvYPMaj12F9eb4y+Zcj31zizBINntd3Skos0jSfASOuLCuLxEgxd+rFNfV3jq3SCKCPPtQ13nE5642JQ8U7QkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=p1oJnnzrDKDa8osgGejfHeExRsNfhxJzdY+IIE9qV8w=; b=a+cfYyzOOsBB3LsKlGdH/hC8dKgF6yZjvCy7Msczn/Hr6fulqbB680BRj9dM+CNAGAwKo0gnt/VXDLgymp1ARhh0Yuj34kdLBd93zN8n7ZDreGx7KtZKNLFfcYBgr//14a+fL/UplLiSkf9Ck/XKioyv8tJsneVbzRf1sMCUCNGA2shE1/iWQTzWKopEfjHq4LTixR3WPMv3eRsWnluubSH0PFJyE3KfzyXuHKkv5EHv71zsSmBToIpPHfkO7y/trwlZdxM8Ui8xMravAQZ63sHaxINa7egsEzBmOJM7jJFiSrAOdWpAxXLoQ6nKF1HtRdnAneBNn31OVJ3x5QZVBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=iopsys.eu; dmarc=pass action=none header.from=iopsys.eu; dkim=pass header.d=iopsys.eu; arc=none Received: from PAXPR08MB6494.eurprd08.prod.outlook.com (2603:10a6:102:154::16) by AS4PR08MB8220.eurprd08.prod.outlook.com (2603:10a6:20b:51f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.21; Mon, 24 Oct 2022 07:30:12 +0000 Received: from PAXPR08MB6494.eurprd08.prod.outlook.com ([fe80::4585:194e:af0f:4a46]) by PAXPR08MB6494.eurprd08.prod.outlook.com ([fe80::4585:194e:af0f:4a46%6]) with mapi id 15.20.5723.034; Mon, 24 Oct 2022 07:30:12 +0000 Content-Type: multipart/alternative; boundary="------------VCy9oj6IlNhQUQYSaIHyU7ax" Message-ID: <216fe2eb-54f4-465e-9206-ac92a91750e8@iopsys.eu> Date: Mon, 24 Oct 2022 10:30:09 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Content-Language: en-US, ru-RU To: u-boot@lists.denx.de Cc: Amarula patchwork , Tom Rini , Jagan Teki , Dario Binacchi , Michael Trimarchi , mikhail.kshevetskiy@gmail.com From: "'Mikhail Kshevetskiy' via Amarula Linux" Subject: [PATCH] cmd: mtd: try to erase bad blocks only if scrub flag is provided X-ClientProxiedBy: GVX0EPF000013E9.SWEP280.PROD.OUTLOOK.COM (2603:10a6:144:1::1d) To PAXPR08MB6494.eurprd08.prod.outlook.com (2603:10a6:102:154::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR08MB6494:EE_|AS4PR08MB8220:EE_ X-MS-Office365-Filtering-Correlation-Id: 00164586-7dcd-4961-6788-08dab5919688 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YFG90JTm+h9zh7lmRA9DIYHu6/ZqpOmpIgRA/R8Ka2Z/PYscY5Jhg/08eBrJu5HwCCFvlLgFHbd1vVKMUEvv5ExnAnO2hz79PUJ5RolSUgZGbK3CWBOtLE2UA8I/oftFRWIKslXnDKhZDosVZdVVEX4+Tzns8xEAXRnpejZz3HSmz6jb2Nf4GeQyRZCZ8KqYF8CuhH4P7QZptjO4bsYVNK6cBGKvmUzDmaaf9GV8FkKQxGXZOUYEHygOvb52O3JAOrFpkH4W9t0OwtH2/hQczowmlGrK2a9tWtdrZrnZV+Ie7aXNmkAGz1VIRolGs+a3R8VLeHjE8zCRVGqvLFPjHQVydk9OAWaeMK3S1qbwaNBpQHISgv/7eUoPQGjhxIlxetVpKKR9nUnGF1Y1b0v6zeG9K5ScG4GGF/dCmnaSf2JmKDJl5QxJ9h8BrEz8PYC5sjIFLbaaWctsFJ10N5KQcJH/AiXAzekCflBAlFus4JNdboS5Ms9pdCfY9uuGxWmzaVS9VwGP783dGu4UUkVCF2g7CPNI0jPS8kKxPSGi6o8DaK2cLbax85M1RO53KcIJmzu0gLSkkYaRsF1Xep/BpiRodnGi0YuRrpdD7kYin9OUyRESXyPxdLPmqF1FFSguUHNUrwFCflmfHRHkn4GjKOZAekAd9Z3IUw/PHwsqvZ4vsF1gGbPV8RwQZDf4Hb530FkOChnD0Q3vKzu7idgJTqmIaYC9RDMoPC4Ur2ALCadafOaRMS8bieziVZaU68q77112N1zOvBQTLos5ttG8nngfYshWl5xweaR+i99Yc08= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR08MB6494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(136003)(376002)(346002)(396003)(39840400004)(366004)(451199015)(66946007)(8676002)(66556008)(6506007)(4326008)(186003)(33964004)(66476007)(83380400001)(2616005)(44832011)(36756003)(26005)(41300700001)(6512007)(5660300002)(8936002)(2906002)(478600001)(31696002)(86362001)(31686004)(38100700002)(6486002)(316002)(6916009)(54906003)(6666004)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?crb/zbkqcQtBeSFerlKuyoWYU?= =?utf-8?q?jlYY2UqMX+5Wv7NG6PEEsfqCRL7dTAy3ULB9EP7xyP/uxJ3hEty9bsLd?= =?utf-8?q?7QJkNOcFwcD+f/KoiLyhO6G6X504pe6Jm+D65GkJVktMMJnk7jBxEJOM?= =?utf-8?q?iPGMNRz5CTbY8H1ucQv8MRjBEeIaNpD2lbontLmegQuPCI1pQ71WoZdc?= =?utf-8?q?b0zFhu2nCZdiwZjsBvUG92ji1M/GNuaFd3LGnQ+SkF/yTxiME1iRfODI?= =?utf-8?q?XkqMduPhPsZ7cuJMnNCAkfrfsHizBryy4og+8EF3l6VKz5DJsBCCBmNj?= =?utf-8?q?OR2hSSpanJiuxfkr1QJbDF4LAwBS3E9lY0IqIoqo//bYGUYQ9McyrhmL?= =?utf-8?q?AJu2O3T1wZ91pM1uQ7KJCF/gtzlMF930ILcBAtDWMUE9OydkzucdV8vL?= =?utf-8?q?554u9IRMoERItgBNaBKUb8C17S9+h6YviM8dLJDKbclzwj1bRhDfZLRC?= =?utf-8?q?J4jXKftsQEmTRPjN11SyArHGg6qgE6OXN4eaWbI8QzDstkkxz1PcyhDU?= =?utf-8?q?NgX6nncdNG0mocvZ24J+GJfYxCrySaOTSRj4Prn59/ob34g8l+5mvSw5?= =?utf-8?q?jaW4GYe0YZhRRHtkTqFxVmIjBf7l1CK/2gZd7OyNXRK8YkIHfUrzBvzE?= =?utf-8?q?RzEnE4ImnV2tXHtxnHr4vY3A/Kdzkk4kVolqTp5GtWy3/foxoB5NsigC?= =?utf-8?q?Zp/G4lgGRUhV+5gZsWGaodMqakPJSDrXUo5WXLFbpoA0WhsmNetglE/f?= =?utf-8?q?m63Rgomch5Ux0Whrjf3Lj1/mHNUzO+RLLxTmDSAvvpNUV7oLcvK5tlzB?= =?utf-8?q?oux8HAG+S/YqXzRLHa5gFAPha48AacKD8wqjq9dlIUqrB3vajAbWHbU/?= =?utf-8?q?MrSmbXQ+egmxh5wmKW+eia5SVq06xAJ6vjzagnZwr+/ELpzJERGFiTKP?= =?utf-8?q?nB6PWbfBmvPkWotWk1H89MQqcpGT013IRfv6xuzRp6aY0Sn8LnW4KphN?= =?utf-8?q?qU1foa9YsyaONxWDkendD+BfZAaWySAQ0deWRwYy45Lps+f+U25VGtlu?= =?utf-8?q?OFJUsmV3cSTM2v46SGDH6wAz0TMoPakOVok6ar4FkwNjVxm+Xq1SF9ul?= =?utf-8?q?gqwh6x4kVNXpScv8dWaijgp4wRWxgAQPknRaa0dPpyeSoEhcTn/RRGHE?= =?utf-8?q?M2j7ShUvuZV0cCxaie9UHuPpdEIpGV30XPhIkFZXBe/py6OXae3rWkoZ?= =?utf-8?q?WSfznBiF43BElYs0d/dsUhgQJsFv96TFrt3AOkhJ/RNyZG1VYM9w5jSn?= =?utf-8?q?r7JuySoIVMURu+ejvBJXORdJjS3mM5+IRzjkbIb4YNoJYnrU00kcxDub?= =?utf-8?q?KWwsk+RNCV09YKznfys6uKyzfiwp3FG8cZOAQcOdlP44ZwJG8/cWVSGH?= =?utf-8?q?wc5OLQHIxRsS7/gDLUQ0H1vIlXuoD4gDo2XsP2aX0L03lz3fwnyqRUVy?= =?utf-8?q?V6bWzuzUArY5Jz/NrSzE35dW88AyI0CyhlJz4eRdslnLNHR1iW12eQze?= =?utf-8?q?PPmNePUh1aiyeIOcOnNAqXe4p7l23TE+OyUNESDi2e7ZsaE4omJewuLc?= =?utf-8?q?uZNrWMjABRsAqunmES50ZwuQhqtT+kovZQUGslO0vG7E2D5dRasUdLqY?= =?utf-8?q?HZF/LeKvOgc7oYqzf+Iz3ixa57Itw=3D=3D?= X-OriginatorOrg: iopsys.eu X-MS-Exchange-CrossTenant-Network-Message-Id: 00164586-7dcd-4961-6788-08dab5919688 X-MS-Exchange-CrossTenant-AuthSource: PAXPR08MB6494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 07:30:12.7859 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 7ff78d65-2de4-40f5-8675-0569e5c7a65d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: flv/mI3S44IIc4Qejs5uzJjGAy3lM+seZ6S3mIT3EQuBADiMLmaQYS4PGKks57wncS1caaUvsIeSqIp/pHLPrD1S+x4CoXK6hgNCciPISac= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR08MB8220 X-Original-Sender: mikhail.kshevetskiy@iopsys.eu X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@iopsys.eu header.s=selector1 header.b=uZQtDuEn; arc=pass (i=1 spf=pass spfdomain=iopsys.eu dkim=pass dkdomain=iopsys.eu dmarc=pass fromdomain=iopsys.eu); spf=pass (google.com: domain of mikhail.kshevetskiy@iopsys.eu designates 40.107.20.87 as permitted sender) smtp.mailfrom=mikhail.kshevetskiy@iopsys.eu; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=iopsys.eu X-Original-From: Mikhail Kshevetskiy Reply-To: Mikhail Kshevetskiy Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 'mtd erase' command should not erase bad blocks. To force bad block erasing there is 'mtd erase.dontskipbad' command. Unfortunately nand layer erases bad blocks unconditionally. This is wrong. Fix issue by adding bad block checks to do_mtd_erase() function in the case srub flag is not provided. We can't simplify code by eliminating -EIO result check of mtd_erase() as it will terminate erasing with CMD_RET_SUCCESS. Thanks to Dario Binacchi for his patch. Signed-off-by: Mikhail Kshevetskiy --- cmd/mtd.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/cmd/mtd.c b/cmd/mtd.c index ad5cc9827d..a314745e95 100644 --- a/cmd/mtd.c +++ b/cmd/mtd.c @@ -434,11 +434,24 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc, erase_op.mtd = mtd; erase_op.addr = off; erase_op.len = mtd->erasesize; - erase_op.scrub = scrub; while (len) { - ret = mtd_erase(mtd, &erase_op); + if (!scrub) { + ret = mtd_block_isbad(mtd, erase_op.addr); + if (ret < 0) { + printf("Failed to get bad block at 0x%08llx\n", + erase_op.addr); + ret = CMD_RET_FAILURE; + goto out_put_mtd; + } else if (ret > 0) { + /* simulate bad block behavior */ + ret = -EIO; + goto skip_block_erasing; + } + } + ret = mtd_erase(mtd, &erase_op); +skip_block_erasing: if (ret) { /* Abort if its not a bad block error */ if (ret != -EIO)