Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10431011ybi; Wed, 24 Jul 2019 23:05:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqx5A55eNJUGUI7J+wGHAE1j3cCwp3nX4pIjhactjCj3yFvVwY4EI/sMvCsXtAkT+74zMRO1 X-Received: by 2002:a17:902:2be8:: with SMTP id l95mr82749341plb.231.1564034733936; Wed, 24 Jul 2019 23:05:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564034733; cv=none; d=google.com; s=arc-20160816; b=Kmnhsh5OtOjIK2gNmGidwdz3Iu81XW5RWwvQcESVLIpJxZ489A2vdP5zSlNMIwCoFS xnA0RVfUw3Yhm0rpgENxpIw4yiit41Vo/x47lEdNNjFM+JTtJKkdsFvHOiq+N+G2gZ4J k/zDDi3BRcUSsKnQ2c1NWjL55asxetwEO1TQx7UWr+ljbyMclXWP1wh64ys89xN4k4Yq WJ+X7l6ZNlmP/MRe2B3fnMfVut0J6Cxjy9W53h5RefDVeI6M1oU/Lh45DO7MJtR7jacn QWjixfEVHdAwOiqDCHJ19PZ2Gc6WbzAMhoLh4kU5DkPUIP2dyV8NhFnrGehZeMBqaM41 6GpQ== 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=+REuLGxsA9MDy6sSJZm2Lus671RKVj0fFvccygtlo1w=; b=WleJ7rGfRs5TtGGNtEulABepHpFTfWdE00zPbRxexvxYi+Oxfnrc7dkcuJUR2mvUb4 /hTv4gwEDc9mm31IrQZ6ySPsYR1Ue6K1B7nxLAhf65iX6kj95gDBGaaNhQznYxOaxEXb 2OSCnpe1k3sawc/Q+PluayfLWTo0a470eOAQpiXInYfPhCVYxUh5K+jMWpNiJzhX9hN7 F4vs8aIm9+fxClTwWZuPcddceT0kw8PpQPxlWm1j0Ohs3BIsvoXqio8UdsvvpYHfSWmy nLFiqha7xfIS1VKAg/bHTIbUG+UqRictq9X72GuQg8zFH12EjLcSYChzL6qYJ9BXYHw8 SFlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=A1isfMYl; 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 c13si15413055pfr.36.2019.07.24.23.05.19; Wed, 24 Jul 2019 23:05:33 -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=A1isfMYl; 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 S2391575AbfGYFrY (ORCPT + 99 others); Thu, 25 Jul 2019 01:47:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:35358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391561AbfGYFrY (ORCPT ); Thu, 25 Jul 2019 01:47:24 -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 7B43522BEB; Thu, 25 Jul 2019 05:47:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564033643; bh=D9Xy9ELjVkCMMIaEPWXKuGZXGNIfDbXEWHcUZVfISjI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A1isfMYlHeRqcaoTgKz2N2FANH3mE073TA+GJF50Fr4mpBsczdHHMc0j4V2meOoQA AkoULl0IcYrgrfzbxzHJMh9Hvgi8s1FOJZewqG3Di72gg/9l+dopYFxCEd4IDCifAE HzRS/i8RS9RkgItWZ7WRvSqYK0TS6Q2sGnRK2xm8= 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 4.19 262/271] mtd: spinand: read returns badly if the last page has bitflips Date: Wed, 24 Jul 2019 21:22:11 +0200 Message-Id: <20190724191717.652553495@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191655.268628197@linuxfoundation.org> References: <20190724191655.268628197@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 @@ -572,12 +572,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; }