Received: by 10.223.185.116 with SMTP id b49csp361690wrg; Thu, 15 Feb 2018 23:42:15 -0800 (PST) X-Google-Smtp-Source: AH8x224MX4iI5fxixq2Rqe/EK0bkdzFD4SwZkxaq5pZLSUGyfswQ3JNWVP7e4Wtxho/MMGd5KTDC X-Received: by 10.98.49.7 with SMTP id x7mr5293696pfx.101.1518766935549; Thu, 15 Feb 2018 23:42:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518766935; cv=none; d=google.com; s=arc-20160816; b=z0xWXiKXO4ekjS9pYGhS8wumYKvWKM+WsSs0QzNRCMza0T6bCvKJTcUfjk2FAy176z F1gBNXHVueA7XQdrHTHn+5Mi9LGzwGpcJcU5VwhyF9U47b2OBOn4X51ab/tBrdmXozvh 0Ee6ks5u69yhe2vVr978FCWLlatpjxJlVeZepBh4vhi0lkc9X4VJPuEBFzIyGAjU+O7A zxe0Bcq2+KWPIh2luPpXrk1mWaQNSkU2/ZJbwLGaWFV8jdwbWvF83Vy8XKoBsZ9t/JWM GuVVuS7YhJzLLu86OzuBG9a9AzcKW5/WyLEuw+acFYnYBDuqWsapjbsRFikfb21ttWIf a3Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ERiEtXaxzGHMx+47MmmDr9LqEy0vqUZlL1ydqGoD3Ts=; b=z/rh1gQgGK0qHVtDMbebPJCnHapoEvbelWu2raynPJUQiwGAxUkj6pWka+jnc3uJ0p Hv/n5Agc/LCae7+HX6tLv8L8CEhjSKikhnv8XgJPOkumAyqgBqRXpoZMLfQhM7lUjVcG QSBMocPWF4MNpr6q2sswId3PaDqVLRBdpCr8epuAuyyYM6LdpzWQpNGhGM+1i9IhkhCt /WVElH/D61BkdS1ZpokoE7h92JO8DT7bZ/GqmGHiQfHTwKKWsb+/tMWaI0CD8+a5STdu /c93bdVMcVTToVtESj+5h/ZiiPmPPS9fwkfwwK6mCHkqrAdx1+baYrwViqMyiZ74jejT G6lQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x13si550989pgt.263.2018.02.15.23.41.23; Thu, 15 Feb 2018 23:42:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034069AbeBOQQR (ORCPT + 99 others); Thu, 15 Feb 2018 11:16:17 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:34368 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1165473AbeBOPo2 (ORCPT ); Thu, 15 Feb 2018 10:44:28 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 5F7DF117F; Thu, 15 Feb 2018 15:44:27 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Boris Brezillon , Miquel Raynal Subject: [PATCH 4.15 091/202] mtd: nand: sunxi: Fix ECC strength choice Date: Thu, 15 Feb 2018 16:16:31 +0100 Message-Id: <20180215151718.183130118@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Miquel Raynal commit f4c6cd1a7f2275d5bc0e494b21fff26f8dde80f0 upstream. When the requested ECC strength does not exactly match the strengths supported by the ECC engine, the driver is selecting the closest strength meeting the 'selected_strength > requested_strength' constraint. Fix the fact that, in this particular case, ecc->strength value was not updated to match the 'selected_strength'. For instance, one can encounter this issue when no ECC requirement is filled in the device tree while the NAND chip minimum requirement is not a strength/step_size combo natively supported by the ECC engine. Fixes: 1fef62c1423b ("mtd: nand: add sunxi NAND flash controller support") Suggested-by: Boris Brezillon Signed-off-by: Miquel Raynal Signed-off-by: Boris Brezillon Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/nand/sunxi_nand.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/drivers/mtd/nand/sunxi_nand.c +++ b/drivers/mtd/nand/sunxi_nand.c @@ -1853,8 +1853,14 @@ static int sunxi_nand_hw_common_ecc_ctrl /* Add ECC info retrieval from DT */ for (i = 0; i < ARRAY_SIZE(strengths); i++) { - if (ecc->strength <= strengths[i]) + if (ecc->strength <= strengths[i]) { + /* + * Update ecc->strength value with the actual strength + * that will be used by the ECC engine. + */ + ecc->strength = strengths[i]; break; + } } if (i >= ARRAY_SIZE(strengths)) {