From patchwork Thu Apr 16 13:23:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 227669 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=ham 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 620EEC2BB55 for ; Thu, 16 Apr 2020 15:16:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2FD3B21D7E for ; Thu, 16 Apr 2020 15:16:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587050172; bh=shd0LP0Bg8wGz6s3YwEhALAbANLNDLZwnav84oEtfjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=RIT57LSdYcSwOcbxi/FRim+f6Ld6LFQP+bwwcLqJGT2S11+fUcGSvKWUIFYoFDu+5 FQvP8HUg/dYkO8CTAmuJuDygPPnPDukOK5m5Oz+K8nouhe5OvIcaWtlq3D3ETCDLFq AoM/iOjAT5TE7oGWnOM3ZJyGoWVrEDUCv5FRlNhU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2395035AbgDPPQK (ORCPT ); Thu, 16 Apr 2020 11:16:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:35836 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2441622AbgDPNuC (ORCPT ); Thu, 16 Apr 2020 09:50:02 -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 4809721927; Thu, 16 Apr 2020 13:49:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587044972; bh=shd0LP0Bg8wGz6s3YwEhALAbANLNDLZwnav84oEtfjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P1fUF88whAGy5wp6zMpfCTe5D6FcZovIUws5LM1ZmwusnBVVedGX2ZKohZK4R2N+o Eoy5kuWZdpjfxhKXmUOfRJbTTwS16UueuKjmkmSEykdhABxqrMnFP8qUVREHSaS6di VTgnUfbUQ+RWKCdSQ8ouUuL1H/jipOwxnRtqiWAc= 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.4 136/232] mtd: spinand: Do not erase the block before writing a bad block marker Date: Thu, 16 Apr 2020 15:23:50 +0200 Message-Id: <20200416131331.970575378@linuxfoundation.org> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200416131316.640996080@linuxfoundation.org> References: <20200416131316.640996080@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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); }