From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93EE4C2BB55 for ; Thu, 16 Apr 2020 14:47:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6FD3C21D93 for ; Thu, 16 Apr 2020 14:47:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587048442; bh=shd0LP0Bg8wGz6s3YwEhALAbANLNDLZwnav84oEtfjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=hmczGLVOf+6JkHSOK7p47S3s6sxuZWIbooVa68NXGJm4qAL4FaCTrcMke3yZjmA3o W6t4PQgoP5WEiKP29EWIFUH86AGdiAgTrLvqfWw1lvmPovmCoavWBKYMvamQvLLzeV tcz5WsosjfE9bIFRhGlallNPyozfEz7RvTZW5GJs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394681AbgDPOrS (ORCPT ); Thu, 16 Apr 2020 10:47:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:46324 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2898809AbgDPN7U (ORCPT ); Thu, 16 Apr 2020 09:59:20 -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 D0C0820786; Thu, 16 Apr 2020 13:59:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587045559; bh=shd0LP0Bg8wGz6s3YwEhALAbANLNDLZwnav84oEtfjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o7hqSajFIW6Cp3u4zO6tVBHm2DFKoTI6iW+yvxQwzgARXVBq4QznTLrDwzlRpsdZ/ iIlpRwY6G32FVreupLYUIzgZwgOVk3lD2oSZirfuDURwLL0WSIhdbdHFz9bIVXcxF8 cpx+C92xN4DfMinb1cafJBhwhLGMRm0NNovB73yQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frieder Schrempf , Boris Brezillon , Miquel Raynal Subject: [PATCH 5.6 143/254] mtd: spinand: Do not erase the block before writing a bad block marker Date: Thu, 16 Apr 2020 15:23:52 +0200 Message-Id: <20200416131344.376085393@linuxfoundation.org> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200416131325.804095985@linuxfoundation.org> References: <20200416131325.804095985@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: Frieder Schrempf commit b645ad39d56846618704e463b24bb994c9585c7f upstream. Currently when marking a block, we use spinand_erase_op() to erase the block before writing the marker to the OOB area. Doing so without waiting for the operation to finish can lead to the marking failing silently and no bad block marker being written to the flash. In fact we don't need to do an erase at all before writing the BBM. The ECC is disabled for raw accesses to the OOB data and we don't need to work around any issues with chips reporting ECC errors as it is known to be the case for raw NAND. Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs") Cc: stable@vger.kernel.org Signed-off-by: Frieder Schrempf Reviewed-by: Boris Brezillon Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20200218100432.32433-4-frieder.schrempf@kontron.de Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/nand/spi/core.c | 3 --- 1 file changed, 3 deletions(-) --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -612,7 +612,6 @@ static int spinand_markbad(struct nand_d }; int ret; - /* Erase block before marking it bad. */ ret = spinand_select_target(spinand, pos->target); if (ret) return ret; @@ -621,8 +620,6 @@ static int spinand_markbad(struct nand_d if (ret) return ret; - spinand_erase_op(spinand, pos); - return spinand_write_page(spinand, &req); }