From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail.x-arc.de ([217.6.246.34] helo=root.phytec.de) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b6CTe-0004xy-2U for barebox@lists.infradead.org; Fri, 27 May 2016 07:46:40 +0000 Received: from idefix.phytec.de (idefix.phytec.de [172.16.0.10]) by root.phytec.de (Postfix) with ESMTP id 35BB1A00B5F for ; Fri, 27 May 2016 09:46:43 +0200 (CEST) From: Teresa Remmet Date: Fri, 27 May 2016 09:44:53 +0200 Message-Id: <1464335095-35180-61-git-send-email-t.remmet@phytec.de> In-Reply-To: <1464335095-35180-1-git-send-email-t.remmet@phytec.de> References: <1464335095-35180-1-git-send-email-t.remmet@phytec.de> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH v2 60/62] mtd: ubi: wl: avoid erasing a PEB which is empty To: barebox@lists.infradead.org RnJvbTogU2ViYXN0aWFuIFNpZXdpb3IgPGJpZ2Vhc3lAbGludXRyb25peC5kZT4KCndlYXJfbGV2 ZWxpbmdfd29ya2VyKCkgY3VycmVudGx5IHVuY29uZGl0aW9uYWxseSBwdXRzIGEgUEVCIG9uIGVy YXNlIGluCnRoZSBlcnJvciBjYXNlIGV2ZW4gaXQganVzdCBiZWVuIHRha2VuIGZyb20gdGhlIGZy ZWVfbGlzdCBhbmQgbmV2ZXIKdXNlZC4KSW4gY2FzZSB0aGUgUEVCIHdhcyBuZXZlciB1c2VkIGl0 IGNhbiBiZSBwdXQgYmFjayBvbiB0aGUgZnJlZSBsaXN0CnNhdmluZyBhIHByZWNpb3VzIGVyYXNl IGN5Y2xlLgoKdjHigKZ2MjoKCS0gdG9fbGViX2NsZWFuIC0+IGRzdF9sZWJfY2xlYW4KCS0gdXN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