Received: by 2002:a05:6359:322:b0:b3:69d0:12d8 with SMTP id ef34csp76848rwb; Wed, 10 Aug 2022 15:11:08 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Q03IFQiRSSGb4y+KShy1TUXCovsXN70wN9Lm6ef4jDxPAmS0YkZTJOcrgsdyHX52iL9rZ X-Received: by 2002:a05:6402:424f:b0:43e:6d89:4316 with SMTP id g15-20020a056402424f00b0043e6d894316mr28182376edb.408.1660169468624; Wed, 10 Aug 2022 15:11:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660169468; cv=none; d=google.com; s=arc-20160816; b=QgmGta7TbZHnKMyg7XLoCxVg/xiakGLVihvtskHT7rjyzRISHiIqqFOs+5OXGE/yqB Cr+EZAYHgmUkARwro8K2gDIEjdQuIl7IrvgsUZdUWcM2aVmSxGFD5xP7OpGY0b2+IVtV Y8FTBcl1oPR+7azPY27Bix/uTqQuZEEfmiOiPNB2j8sJFdhKQe/AQwz7PLBQbBWM4bTn d/eNbQXmpi5zLhoEsaMU97EJ75aWnMO8WYm43knI8Zu0ZJ4VdCPdk+FfxCDO8feOvV6F hlMipVy8pLcOncT0eyaVCTl50UQTv2Ch1KV4XI3hfUf0yLv8AhOx1Wv0622YUKWj4bgP dc/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=41mI0uugblWMUTssmahtd2l/fAYAHT04UlAk02aSkT8=; b=Ck83TsFJ5hCBIYicxa6lzX/XEF7xmgxG9ejOjeoEOsrFaWfYhVDz+0rgLnshCtusjg XPdz0W+R02uJ0Dm9ip1DL4rJpW2G/CsKggz8miWbGKPfUVBmmTvMKsn/eICHOFyeBPvb TpkBLEzekML9oazjkDSpIl44jDM5gsIAIp51QgWEllLVJo6kkB7iQ566mzSOu23y0bay c2OVQ4rYxn+AIqqJ8rOFdYkVlTB8lQ0nWMgD3Of2pwJfLvvdGThsq+XzK69av2rRVQPL BepYd3mLPuoTEIMwbEuBioA3oMdsz4H5ovbcNA3EG6SXJAAQ1JVqTAvcUq1Z06cj50Hu JNvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=vYjfLZ8+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r29-20020a50aadd000000b0043d6e7719cbsi12882078edc.470.2022.08.10.15.10.43; Wed, 10 Aug 2022 15:11:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=vYjfLZ8+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233420AbiHJWHa (ORCPT + 99 others); Wed, 10 Aug 2022 18:07:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233214AbiHJWHP (ORCPT ); Wed, 10 Aug 2022 18:07:15 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [176.9.125.105]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B217792DA for ; Wed, 10 Aug 2022 15:07:14 -0700 (PDT) Received: from mwalle01.kontron.local. (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 4D80722253; Thu, 11 Aug 2022 00:07:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1660169230; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=41mI0uugblWMUTssmahtd2l/fAYAHT04UlAk02aSkT8=; b=vYjfLZ8+Cr3jl63gwAXfHrTKRcp4pPUkS0dW33d3fW7wkLV8Jr+dwHVhc02l5esXB0nb3Z 4LULct3uLgYVeqy6cXM+2NX9RXYJgXAJtA6/gOJN7nOb1zxp8Xot2RtPcWQ1JqE2UwDcOx DwQ/XOBVjO8Q4APucjgm09g2+QDaLWA= From: Michael Walle To: Tudor Ambarus , Pratyush Yadav Cc: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, Michael Walle , Jae Hyun Yoo Subject: [PATCH v2 5/7] mtd: spi-nor: fix select_uniform_erase to skip 0 erase size Date: Thu, 11 Aug 2022 00:06:52 +0200 Message-Id: <20220810220654.1297699-6-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220810220654.1297699-1-michael@walle.cc> References: <20220810220654.1297699-1-michael@walle.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4bait will set the erase size to 0 if there is no corresponding opcode for the 4byte erase. Fix spi_nor_select_uniform_erase to skip the 0 erase size to avoid mtd device registration failure cases. Reported-by: Jae Hyun Yoo Signed-off-by: Michael Walle --- drivers/mtd/spi-nor/core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index f1d01c7dacce..42f9bb63919c 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -2118,6 +2118,10 @@ spi_nor_select_uniform_erase(struct spi_nor_erase_map *map, tested_erase = &map->erase_type[i]; + /* Skip masked erase types. */ + if (!tested_erase->size) + continue; + /* * If the current erase size is the one, stop here: * we have found the right uniform Sector Erase command. -- 2.30.2