Received: by 10.223.185.116 with SMTP id b49csp18081wrg; Thu, 15 Feb 2018 15:39:35 -0800 (PST) X-Google-Smtp-Source: AH8x227G0ox1tcH2NJCV3NFICFs/7B4WyTc/3jkqCpUMaOLB3d8rDEBkwupohdlbMWg6qzOHgPIz X-Received: by 10.99.109.79 with SMTP id i76mr3411896pgc.402.1518737975755; Thu, 15 Feb 2018 15:39:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518737975; cv=none; d=google.com; s=arc-20160816; b=LjkJ+aRjEa+/tG9c3RM+AEHPmBqsJ2wDt4paY9xRWDtp4OOx5drrYsbikABZ3q99Qu GvPYMh96dGmr+y63XqZ4/twLncvLIr0KlBkFVIsk7Pj1ahFLzJ/1MjagsMkS/kYLzr5i eVCdgTKDHrPmx+khAYc0Tc5G1KCTchSABvumtEu2pYujGvdHpen7KkrLdsm77mEH+hew LMq00hZ5xC/FfLjKplk7iZne2aFQfzhHtKmvMQ7XDgRnQ2+4v4TEmdaorHhb0SU+X4dL dH1SVMaOSRyXcw04kS9JSbOtSzdT+uAc7O+hmobl0gjhd7u3pDzEjUAOv6XGSvrmwQVB rd1Q== 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=Pr6QFJ8Yu8mxlEnUPfnAvpfUx6kui/ozxUxw0fQwv3E=; b=nqtk5p8KcV4TA1TUvAS4pkEoVJ+hwDgX5mReClsXb47DJT8fidRNB7/A2tfdidNWMz fGTyyWxcMFSez9Jvqpj6TTZE7ttvhQkBRkC5t5tHZhITZA76kRL1q/ImvfcgJVgnElH2 0fAhD3OlFK5B9AkEZHAQTwZMF+XrHYVs1rzaeJfXNiBQmH/MESWiL/eu5YFbOm9TABGV a+3mxUB6Ulxhws0jsZWsMdEFtif29PFG3VR2GQw8yyRIXvPy+4A/a+9No86CuPmNuUvn N3V1GnfHuMce7CNqe5/3LsJzcdcIrKcEovJWoQNQFDO8xzK3yryxPU1rvTDrpnnpPBWr V3KQ== 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 c19-v6si9260657plo.278.2018.02.15.15.39.21; Thu, 15 Feb 2018 15:39:35 -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 S1164990AbeBOPdz (ORCPT + 99 others); Thu, 15 Feb 2018 10:33:55 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:56944 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1164978AbeBOPdx (ORCPT ); Thu, 15 Feb 2018 10:33:53 -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 ADE6610D2; Thu, 15 Feb 2018 15:33:52 +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.14 098/195] mtd: nand: sunxi: Fix ECC strength choice Date: Thu, 15 Feb 2018 16:16:29 +0100 Message-Id: <20180215151710.599351295@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151705.738773577@linuxfoundation.org> References: <20180215151705.738773577@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.14-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)) {