Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp738059imm; Fri, 22 Jun 2018 04:35:50 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKWQ3NVh4jQcDQtP+3Yzj2FnUXCN0G6SVUP9mdJEX0QoAzmXuSY/d8Q/fqMUlm52/lriwx6 X-Received: by 2002:a62:3b5d:: with SMTP id i90-v6mr1393498pfa.24.1529667350627; Fri, 22 Jun 2018 04:35:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529667350; cv=none; d=google.com; s=arc-20160816; b=0IaTDMGvCOfMqQk3ZDhflZ39CDnRXqON1+ivZklAbDCFdDSFXj7n6ghRG9WFYxJ/rf HiesQxeK/7dNgDtWybPRmMDqy1tx7q4LxYa7xZSuO2A9jhzYI+uzx9vY3iNy9OApS3e9 25f6eNuRxTZOknvrACe3gZfXHHGAqnHutBeN1RvU49xzVVWUCvSYOGGafTKgi3b06hAg T0ki4+oi4P8IRcbW1fOdENthNWrziYOk6GYlKMfprhbnnOjD2OZPBAcBpjYl+6EamHgl CJkyiZY6E+aHASzICbmwIqgfcptNy9gv3ViADrg6pAIeiHJszNze97fSDpnjc6f3XC7/ bcxg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=RmdYgHt9tsey4s7KicINJtpN2inwZpRWF0yPtz3/fcM=; b=ZKepW4663cthk97dOfv94WjNsN+ZFujhBYIT8w0RHKWr0fOVx41i8MUX4P1blvN4Qa GZ7oNatgoQDgd5jgc8Rql2MiLqVA+uTxOvjTSWbgA7o+vUKo+VdYUXs0LS3YS2WtQbd8 6TUT2bHOMiCgMrueFnT+NfiPwxz/Xj+OmHjOyV6MmtznJ7iP/Ndxd4A/Ue4afan5E6hr bPF4W3noMWUFDmaE17VfbjlRTo8RNFzYnh5liAeW0HZt7wf0hdrbOGdnPX8xkiBxp6pa NSQH6Xe1k+inGxQlvq4ylfD4WyXihOEcn3TJDWU19puWeFOe33tHr6kP5NtJPOolUr4V ri0w== 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 y21-v6si6860940pfm.1.2018.06.22.04.35.36; Fri, 22 Jun 2018 04:35:50 -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 S1751394AbeFVLeu convert rfc822-to-8bit (ORCPT + 99 others); Fri, 22 Jun 2018 07:34:50 -0400 Received: from mail.bootlin.com ([62.4.15.54]:50210 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751206AbeFVLet (ORCPT ); Fri, 22 Jun 2018 07:34:49 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id C94BB206FF; Fri, 22 Jun 2018 13:34:46 +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 bbrezillon (AAubervilliers-681-1-50-153.w90-88.abo.wanadoo.fr [90.88.168.153]) by mail.bootlin.com (Postfix) with ESMTPSA id 7734720012; Fri, 22 Jun 2018 13:34:36 +0200 (CEST) Date: Fri, 22 Jun 2018 13:34:36 +0200 From: Boris Brezillon To: Miquel Raynal Cc: Abhishek Sahu , Marek Vasut , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux-mtd@lists.infradead.org, Richard Weinberger , Brian Norris , David Woodhouse Subject: Re: [PATCH] mtd: rawnand: fix return value check for bad block status Message-ID: <20180622133436.39e1466d@bbrezillon> In-Reply-To: <20180618155757.6cbe0fae@xps13> References: <1528880556-20348-1-git-send-email-absahu@codeaurora.org> <20180618155757.6cbe0fae@xps13> 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 On Mon, 18 Jun 2018 15:57:57 +0200 Miquel Raynal wrote: > 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 Applied. Thanks, Boris > > I suppose this patch is a good candidate to be part of a future > mtd/fixes PR? > > Regards, > Miquèl > > ______________________________________________________ > Linux MTD discussion mailing list > http://lists.infradead.org/mailman/listinfo/linux-mtd/