From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail.phytec.eu ([217.6.246.34] helo=root.phytec.de) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b4lEV-0000K8-QD for barebox@lists.infradead.org; Mon, 23 May 2016 08:29:06 +0000 Received: from idefix.phytec.de (idefix.phytec.de [172.16.0.10]) by root.phytec.de (Postfix) with ESMTP id E2720A00CF5 for ; Mon, 23 May 2016 10:28:27 +0200 (CEST) From: Teresa Remmet Date: Mon, 23 May 2016 10:26:48 +0200 Message-Id: <1463992010-31537-61-git-send-email-t.remmet@phytec.de> In-Reply-To: <1463992010-31537-1-git-send-email-t.remmet@phytec.de> References: <1463992010-31537-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 60/62] mtd: ubi: wl: avoid erasing a PEB which is empty To: barebox@lists.infradead.org RnJvbTogU2ViYXN0aWFuIFNpZXdpb3IgPGJpZ2Vhc3lAbGludXRyb25peC5kZT4KCndlYXJfbGV2 ZWxpbmdfd29ya2VyKCkgY3VycmVudGx5IHVuY29uZGl0aW9uYWxseSBwdXRzIGEgUEVCIG9uIGVy YXNlIGluCnRoZSBlcnJvciBjYXNlIGV2ZW4gaXQganVzdCBiZWVuIHRha2VuIGZyb20gdGhlIGZy ZWVfbGlzdCBhbmQgbmV2ZXIKdXNlZC4KSW4gY2FzZSB0aGUgUEVCIHdhcyBuZXZlciB1c2VkIGl0 IGNhbiBiZSBwdXQgYmFjayBvbiB0aGUgZnJlZSBsaXN0CnNhdmluZyBhIHByZWNpb3VzIGVyYXNl IGN5Y2xlLgoKdjHigKZ2MjoKCS0gdG9fbGViX2NsZWFuIC0+IGRzdF9sZWJfY2xlYW4KCS0gdXNl IH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