Received: by 10.223.185.116 with SMTP id b49csp2374371wrg; Thu, 15 Feb 2018 10:36:48 -0800 (PST) X-Google-Smtp-Source: AH8x22733P4v4VRAcedXaUT5HqDSiKJQ+PfXDrLVix59a5XMxHRe0uOt7P+TAQrA3X5hRQegvNbF X-Received: by 2002:a17:902:2f03:: with SMTP id s3-v6mr3449495plb.112.1518719808105; Thu, 15 Feb 2018 10:36:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518719808; cv=none; d=google.com; s=arc-20160816; b=hQGeyt8AeIUk9WxRfieiOl7RF+OeaFuEa42rqUzbXWIPSQfQDVyePJOhnEB7zfB9iH oLhqd6vKe1NhePjEq2gW4U1KNjdEOlXtyFShRpwUWN10GWwA/2EfeUKQkxWzNprBOJPA ULEpXKhohYyASc2QqA1Ve/FYWfCiP8PdfefW8ghKDVDFWurpMbwtmvYzJKpzYjGtkJQR JbBX7oiSPxktOT5lHn/zozf+QtIyLFUOdkeB6WkigL1NEV5wwDl6nY5pGnx7l5bLa6gZ cnOs2FQxUnBTta40GjM82xkHDlJi2sURnAqwJlHk41euNA3zA3JRff3H09QFVOb4jb9/ Bzyg== 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=uUOOoB3lmgZha77LGi1Z+PZbnYTF9ABvs1yhIkky1p4=; b=gX6k8G78iycNZeVUM0SMWcd29ywYFrbg2jITc6zhkEIoCFpBEuRKgAozwXLNN9vlDV 2TL3SMCtckuLnxmlISxNIZ3Ri/agIjxo0pjOXFsgPtunqpd3DJGnAD0x7sZUmQwG9uvt 8h1snFXzaZy0qLSHfKX8IOGG7zB9V9B1YePde9BD6H+V/jowTGI01tGbDxeCnM72fNpc LP/fHS614DB04bGtxfyXuRZsmjQ6tDj9GOQqmS3s2oVXXDhgeYgYWnWwCHdRI0zpYd0A pS2dd5TwLEPHBGJN3S3jJ1vSrq28byWCQqtnxxwvn5D2HAxLokMT0YqXc5+aoqI5RheH tBRA== 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 97-v6si1899354pld.599.2018.02.15.10.36.33; Thu, 15 Feb 2018 10:36:48 -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 S1166621AbeBOSeQ (ORCPT + 99 others); Thu, 15 Feb 2018 13:34:16 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:51942 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162926AbeBOPYk (ORCPT ); Thu, 15 Feb 2018 10:24:40 -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 7F3C7DE0; Thu, 15 Feb 2018 15:24:39 +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.4 057/108] mtd: nand: sunxi: Fix ECC strength choice Date: Thu, 15 Feb 2018 16:16:54 +0100 Message-Id: <20180215151230.382173899@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151222.267507937@linuxfoundation.org> References: <20180215151222.267507937@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.4-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 @@ -1046,8 +1046,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)) {