Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp393063imm; Wed, 13 Jun 2018 02:03:41 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK+u5SyC9lXJhXqStLSxduEhoCflhUGbWIxRon8BUr3YkCGCnXtlupifAFYbKWyTi7b2+iP X-Received: by 2002:a17:902:7b95:: with SMTP id w21-v6mr4299469pll.150.1528880621024; Wed, 13 Jun 2018 02:03:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528880621; cv=none; d=google.com; s=arc-20160816; b=QQn/xrstfH1GjmK8ocfUq1qJujs0xe3rFCkhnL919KIY8mCifSbTXak7CIdmK5zCUj 5ZzkuYoZx6nT7AFnzDfwSgldnY8LFXYqAfIzaU5jyVqQCo0uDxbr9tbRR2AoqpFQOLFz m07TMlXuTd7r/zrin+xfQb47oTQIdbpVGUmPDXn89TC3AbxiIPKXdLvhjrQDiYvxYFS5 fbleo2GilLycC8pyVox0ocQ+YOYcrDq9/IyB/RoQUD9HeKJVdKLCAdxuwebZ2dZa9msQ OWtq2IcWL9OwjcHY20hRjPYfXIDEhhZeVo18ZiaEK9l4yY0vRi5fCIPHPxfZ4Hza+WgI Hwqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=5RDvj3ldWw08IIZm93wKFvRvmU49JeZ0N3BM4LseRwU=; b=t7DLqGlc+lsqyIdkOhNQKkNk/3bRvWeMEOFqQaA84wBFKnrQjhXdwWqmD78qa4a5FM Ehcvj3favPQEbqcyvlmDcwuce5RPcbg9uAk4Woo0kDZMWZHWaEDACKnnWADNnBNOfsrR 6GFZR3z5Z57z+S+t429151UY2Y2uZO9LccfdgTzz2VTFCiD4am5onJ4hr8N5oCS92H7s 0G0cU2aojZE6sUvtsW1cXDvO7o5W/Gx3Mcct6xvSdgeIANaduRKnu4UKC7Gm5UMnTOQe UA5PMcFyJ24v9RfUndgNfrzxZpT3K7DcRva1s/1JnJhtMaLf9ba/pUe27QI9PMQK7DvB vFtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=F7uh66Rf; dkim=pass header.i=@codeaurora.org header.s=default header.b=VdvW0VbY; 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 w23-v6si2384939ply.320.2018.06.13.02.03.26; Wed, 13 Jun 2018 02:03:40 -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=@codeaurora.org header.s=default header.b=F7uh66Rf; dkim=pass header.i=@codeaurora.org header.s=default header.b=VdvW0VbY; 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 S1754541AbeFMJCt (ORCPT + 99 others); Wed, 13 Jun 2018 05:02:49 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:39644 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750922AbeFMJCq (ORCPT ); Wed, 13 Jun 2018 05:02:46 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 4E5EC607A4; Wed, 13 Jun 2018 09:02:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1528880566; bh=fl6gQW5SIy21oP3dRmfZs3JwXPRdmjmKR+fZnpIVOuY=; h=From:To:Cc:Subject:Date:From; b=F7uh66Rf4i1eWn0tAzAvlZKN4orHtggqJI1eA9amGTvBsov+w+ifhUgni9sSBmVKI 81xQ+jbFAKdAt5sOBodRQOZXFZx2VTcHZij2R695Pw6HTQOZ+ru0UUZeoixULiQLqV PPYl2vYQVqP1b8ON3nJBcDP+gw3vhTuyKlHcehHs= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from absahu-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: absahu@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id A2EFB606DB; Wed, 13 Jun 2018 09:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1528880564; bh=fl6gQW5SIy21oP3dRmfZs3JwXPRdmjmKR+fZnpIVOuY=; h=From:To:Cc:Subject:Date:From; b=VdvW0VbYD4pI6bLeUuJwiDfLy0JCGxYKT/6iFMM/+79J5pGSC/3CSd6KRwsFt3o0H CwOkoHQaKGGlwERH/0VOrj5SXS58b83OXyrm5s9c0gIP31Zpck1KJFm0u2Z7fYvFUu xfYBPn7rvUdPDNbW8eJC28Sgl1mFj3ODoYLPwj3U= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A2EFB606DB Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=absahu@codeaurora.org From: Abhishek Sahu To: Boris Brezillon Cc: David Woodhouse , Brian Norris , Marek Vasut , Richard Weinberger , Miquel Raynal , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, Abhishek Sahu , Subject: [PATCH] mtd: rawnand: fix return value check for bad block status Date: Wed, 13 Jun 2018 14:32:36 +0530 Message-Id: <1528880556-20348-1-git-send-email-absahu@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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]; -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation