Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3957610imm; Mon, 18 Jun 2018 07:00:12 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKiF2/S1Z/lnewsbzczlV+fzyvjM268FReXGK6ZTGgZ1PpqqjHXNrLOkTxEZSzDt+/90rKj X-Received: by 2002:a17:902:900a:: with SMTP id a10-v6mr14387706plp.41.1529330412806; Mon, 18 Jun 2018 07:00:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529330412; cv=none; d=google.com; s=arc-20160816; b=lpOJJZxyiFlVPHgawykcHcTy91HbfOE9+EHwJ8veStw1lL8VcbRRCJq8B7aRmAJIfv mxxM0Pc3I/4Lk9TO4/fph9S6oa8/qfd6YelW3C185kEEgnt2jivUpkXNQ6o5bwwzPhcE JnxIyrNkXQX3BjryHC7475wcEsJZWF2H5VebKvi3Emqr1XPuBg32kraOfQwaAY3P0LRA co0nhIxzdG2Xrf9xFz/nPV9jPcpCVWXSLMuw1KA1+WAEIoaN5lG0Q09enYEb42vuGGOt 8e+Kvh1Y7ozMELG3EQpjz71s9dwHgDuh4H8v5T7ZnncSpSuxcD/i64GwnVRLH+ptH4Fd rRcQ== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=7mPQ9oswOspYiIuqX9u4CBi6jQWB6XYqNx+5UKu+yuk=; b=jh7eqmJxiIF0o3aDlfbSU/3k9Dgo+CC0E3TkUSq3F67fENOcQL5+ZAtvhDaVDr0zNL BZwmWtgvMcEv+gnQ04ieY0glH6TGS/ls2Ua3+ED6LL2Y+ReOQTFUwAUevIGPll6wblfm iBf2xe6KqPFZv+RcGUyqqAK6mYrjHhEL25xScQ6fVcV5D5rOo/KmX2LwI3idEm42FHcG T7BwI+++LLzNLR38pSWMUjNnjPBXIPmBnJl4bluOiL1vjUOd/cjF4Erv64Bge/O8AV4I UuSIvKcIX7uGf7YPHg2p0wpek1VsfOGfx0EhLHQh0NQcq8KvpIT9s4JpHV8L5WrWRtfe G+zQ== 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 g6-v6si13386768pfh.346.2018.06.18.06.59.58; Mon, 18 Jun 2018 07:00:12 -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; 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 S933976AbeFRN6C convert rfc822-to-8bit (ORCPT + 99 others); Mon, 18 Jun 2018 09:58:02 -0400 Received: from mail.bootlin.com ([62.4.15.54]:38181 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933659AbeFRN6A (ORCPT ); Mon, 18 Jun 2018 09:58:00 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 3C62020798; Mon, 18 Jun 2018 15:57:58 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from xps13 (AAubervilliers-681-1-50-153.w90-88.abo.wanadoo.fr [90.88.168.153]) by mail.bootlin.com (Postfix) with ESMTPSA id E27F520703; Mon, 18 Jun 2018 15:57:57 +0200 (CEST) Date: Mon, 18 Jun 2018 15:57:57 +0200 From: Miquel Raynal To: Abhishek Sahu Cc: Boris Brezillon , David Woodhouse , Brian Norris , Marek Vasut , Richard Weinberger , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, Subject: Re: [PATCH] mtd: rawnand: fix return value check for bad block status Message-ID: <20180618155757.6cbe0fae@xps13> In-Reply-To: <1528880556-20348-1-git-send-email-absahu@codeaurora.org> References: <1528880556-20348-1-git-send-email-absahu@codeaurora.org> Organization: Bootlin X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) 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 Hi Boris, On Wed, 13 Jun 2018 14:32:36 +0530, Abhishek Sahu wrote: > Positive return value from read_oob() is making false BAD > blocks. For some of the NAND controllers, OOB bytes will be > protected with ECC and read_oob() will return number of bitflips. > If there is any bitflip in ECC protected OOB bytes for BAD block > status page, then that block is getting treated as BAD. > > Fixes: c120e75e0e7d ("mtd: nand: use read_oob() instead of cmdfunc() for bad block check") > Cc: > Signed-off-by: Abhishek Sahu > --- > drivers/mtd/nand/raw/nand_base.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c > index f28c3a5..4a73f73 100644 > --- a/drivers/mtd/nand/raw/nand_base.c > +++ b/drivers/mtd/nand/raw/nand_base.c > @@ -440,7 +440,7 @@ static int nand_block_bad(struct mtd_info *mtd, loff_t ofs) > > for (; page < page_end; page++) { > res = chip->ecc.read_oob(mtd, chip, page); > - if (res) > + if (res < 0) > return res; > > bad = chip->oob_poi[chip->badblockpos]; Reviewed-by: Miquel Raynal I suppose this patch is a good candidate to be part of a future mtd/fixes PR? Regards, Miquèl