Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10278142ybi; Wed, 24 Jul 2019 19:56:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxGdG9+OUHYOANRMojTE5DbCwdVfB7ooabFe2GwJUOmxL8sEYeyzDwSZTLFlqkbOOaVzHfA X-Received: by 2002:a63:a302:: with SMTP id s2mr14824242pge.125.1564023386431; Wed, 24 Jul 2019 19:56:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564023386; cv=none; d=google.com; s=arc-20160816; b=uSuXiVegKcxS0T/BW41VK7D4SnQveD/y5Dj4R4SxdDSoz/QVSocPdeUgvfraPw1kYr Im1dBfjQO4g8Z+SqpeGJO5SNqNsK2s8k92k3dvWBdaby+NG7zaF9nAkKKgSlyI+zCcfC 0Q6vif2F7wablwDl2H40z/ECJPX/zVHfYtIdRqJtip5V39MtNefSfSB0kpW6nd89t7wN 4Omda1XGjyojpjsgqobWDOzCSUAjNNTIGwTPnhFeuLAeUlNYxEEgKOnGkC789ZoeUnbd ox8cyjk5T8klbHsH6jsvVqnxnu2PKhy7IDw8u0cVGzm+zfW0SKtpMuNDmz748yeDd4W0 00PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LY43Lwxw5pb31V0ZX+otuciZ3XLAWZhVbf5PTy83lE0=; b=LeXbtKkT1kI4blDagfNXKV6BjiAcNwmkCcFK4ducGLQtYplbfD+6G6R4IhlzVAZaNS WbbCoW5lDw4McdVehTAdbqD48mL8bRNos/Hi8OnntEgUUldSY21n6Q6N56In4Im7PD1K i648QqVZJm0hYTwqZEBkWp/PBFMap96MvqSamX8a8O9m1YhBI9hVITbu0Db+N/kvF/li l4JZbx/TbOE6nfqNmb9wk/mqg2jakh1ZI+CG1wNyyvJZ1kkPTDkzVp9ACZwu64CPICrk ndmTaHxR51MNs0Xx39SODUqL4Wimvh/MOMaQThGBoqfaEfoTGc2XtQOinTawkoMjW+1S hbgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JZZ2d+Iq; 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 r16si15057263pgv.466.2019.07.24.19.56.11; Wed, 24 Jul 2019 19:56:26 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=JZZ2d+Iq; 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 S2390321AbfGXTmK (ORCPT + 99 others); Wed, 24 Jul 2019 15:42:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:43646 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726837AbfGXTmF (ORCPT ); Wed, 24 Jul 2019 15:42:05 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E518022AEC; Wed, 24 Jul 2019 19:42:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563997324; bh=Zui+Y95a8U24rYFho+CbP5JtAUkVNJtHI9RDcy+HTvI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JZZ2d+IqEh15/UKYJfYdqUr33DW0HrgFfzYDhq0afSxWDS7ia7c9fEmfsx3slxnXv ImiF5kQ1BTE9WzHagLPfmsboqpTZKIgVS9rd86tMbYNfBGuR5UeWO0DO4Mr0ZnQxQW EhHH+8Fwr+OM0r0VE3s2DC/bWo+uC5Y8uvdAY4q4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Weixiong Liao , Boris Brezillon , Frieder Schrempf , Miquel Raynal Subject: [PATCH 5.2 398/413] mtd: spinand: read returns badly if the last page has bitflips Date: Wed, 24 Jul 2019 21:21:29 +0200 Message-Id: <20190724191803.377727180@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: liaoweixiong commit b83408b580eccf8d2797cd6cb9ae42c2a28656a7 upstream. In case of the last page containing bitflips (ret > 0), spinand_mtd_read() will return that number of bitflips for the last page while it should instead return max_bitflips like it does when the last page read returns with 0. Signed-off-by: Weixiong Liao Reviewed-by: Boris Brezillon Reviewed-by: Frieder Schrempf Cc: stable@vger.kernel.org Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs") Signed-off-by: Miquel Raynal Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/nand/spi/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -511,12 +511,12 @@ static int spinand_mtd_read(struct mtd_i if (ret == -EBADMSG) { ecc_failed = true; mtd->ecc_stats.failed++; - ret = 0; } else { mtd->ecc_stats.corrected += ret; max_bitflips = max_t(unsigned int, max_bitflips, ret); } + ret = 0; ops->retlen += iter.req.datalen; ops->oobretlen += iter.req.ooblen; }