Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp976532imw; Fri, 15 Jul 2022 17:19:53 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vGKIq/bYHn3n+ZjoUAhRr1tiZgbYlhJj6G297zCS05hm0+YCwigu5e/Cj16Ma7PsRBSE2z X-Received: by 2002:a17:903:104b:b0:16c:d18b:60e7 with SMTP id f11-20020a170903104b00b0016cd18b60e7mr2879317plc.53.1657930792745; Fri, 15 Jul 2022 17:19:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657930792; cv=none; d=google.com; s=arc-20160816; b=uy9+PZ42317btCOreNrpkViKPPS/6uPtLJPSfcYQB59la7xB3LGnuKolon0rryTgMZ UeJ4dLEO1DoKWIVwdYVopN5jf8qKgwxTZSL7nZtXnjxY2ks6ZZUAIT0djIQP3sYjTS1e Qh/xAhX/mK8mV7m8To2P2ufYT/TWVWDkbO06ciFG7oJovSuliEoCOK1SeizblKq08s8M 1jGyyjLvM0GHDu7l5np3e9xSMAtG42HC4/CsVs6vuiOcsSZKgDSHALL/oLHXL1DjTsf8 zBO3l4JK5rTQu8QaxylzlbgQ2yntiCCiwQ7OkV1NoATzf56Uqn4yqCJtJKAw04MryebM mXag== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=B0NmcVWqBiIJwuMdhqHTpX2jPTKLv5AzIu63NOheRms=; b=KJ+X2zavuWX+inPVr2H8orijHqSIyJUMPslMAQJ1aDgX0OXFF70tOTpyXmmGENv6cr ZXM6ygOmAJ7eYxTMPe+Ywk8otCDvU9/tEfvHj5mU/4oZ2Ee60MdUXi6AL8UBaNOSAhtC mwUVa3QuIDifaNw3LHpbl4dIB3Qux9Js6cdMBGfQCKfWjhOJiizVSaIUDTxGN0R4Aftq eQklGpeDCaEoDiWRksT4TTCsYGRDntn/CPIJKh16dV4MY4NhnpeHU8ChigWDhjetkmSc eVjCK44WFG7gWLUprgSHWI3mFPIasabEQNOZMMHFN2/yGwQKkWmeIwWKOvqnC/tA6HWU GQ9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=vqiWTO6y; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d31-20020a631d5f000000b00414dde80438si4553118pgm.348.2022.07.15.17.19.38; Fri, 15 Jul 2022 17:19:52 -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=@quicinc.com header.s=qcdkim header.b=vqiWTO6y; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231633AbiGPAHJ (ORCPT + 99 others); Fri, 15 Jul 2022 20:07:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231286AbiGPAHI (ORCPT ); Fri, 15 Jul 2022 20:07:08 -0400 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B850215FD3 for ; Fri, 15 Jul 2022 17:07:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1657930027; x=1689466027; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=B0NmcVWqBiIJwuMdhqHTpX2jPTKLv5AzIu63NOheRms=; b=vqiWTO6yMVu/vajEF3vmmtwNSIVzbGDP3eYiqMn5cWF8yYEq7Nf8/u1h hwZ08tF8Yf/QTGd3H0ozUcYX1JmiXhNNt7Oo/lhMFHTPAuA98zIleNKhU /5Kln8GN/JIBKN1TQ515G7ZK8MdBEZkKArBfogaRGZD91u4CTXGepa+LJ U=; Received: from unknown (HELO ironmsg03-sd.qualcomm.com) ([10.53.140.143]) by alexa-out-sd-02.qualcomm.com with ESMTP; 15 Jul 2022 17:07:07 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg03-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2022 17:07:07 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Fri, 15 Jul 2022 17:07:06 -0700 Received: from maru.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Fri, 15 Jul 2022 17:07:05 -0700 From: Jae Hyun Yoo To: Tudor Ambarus , Pratyush Yadav , Michael Walle CC: Jamie Iles , Graeme Gregory , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Jae Hyun Yoo , , Subject: [PATCH v3 1/2] mtd: spi-nor: fix select_uniform_erase to skip 0 erase size Date: Fri, 15 Jul 2022 17:06:42 -0700 Message-ID: <20220716000643.3541839-1-quic_jaehyoo@quicinc.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) 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 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 From: Michael Walle 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 Signed-off-by: Jae Hyun Yoo --- Changes in v3: * Added newly in v3. 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 502967c76c5f..666ef6ce9549 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -2113,6 +2113,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.25.1