Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDCEBC433EF for ; Fri, 1 Oct 2021 10:30:51 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DACEA61361 for ; Fri, 1 Oct 2021 10:30:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DACEA61361 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D7FC0820E3; Fri, 1 Oct 2021 12:30:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="CwTimROG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 364BB81FEC; Fri, 1 Oct 2021 12:30:46 +0200 (CEST) Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D5D8A81725 for ; Fri, 1 Oct 2021 12:30:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=p.yadav@ti.com Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 191AUXll077999; Fri, 1 Oct 2021 05:30:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1633084233; bh=HuAGmHZL0fR/mxj5fdJZy9qvS4ZqhQXmP9N4l2B0SuI=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=CwTimROG/9MntTaNPJcBcjmS71vQcH9enEjXcs6SQodIRJ1/sXsP4iwCapPIA/xGT 4zIENcH3QWDQkzsXL2iGOmDsijWONwqPU4w9IxGK5jqOlERz8/lyV9FjZL8aYD46yP yeHMzMoAuU1V61xUQexNtP6LX825pJRf+y43SuVQ= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 191AUWjF003975 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 1 Oct 2021 05:30:32 -0500 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Fri, 1 Oct 2021 05:30:32 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14 via Frontend Transport; Fri, 1 Oct 2021 05:30:32 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 191AUVcw011770; Fri, 1 Oct 2021 05:30:31 -0500 Date: Fri, 1 Oct 2021 16:00:30 +0530 From: Pratyush Yadav To: Marek =?iso-8859-1?Q?Beh=FAn?= CC: Jagan Teki , Tom Rini , , Patrick Delaunay , Pali =?iso-8859-1?Q?Roh=E1r?= , Patrice Chotard , Marek Vasut , Marek =?iso-8859-1?Q?Beh=FAn?= , Simon Glass , Masami Hiramatsu Subject: Re: [PATCH u-boot-spi v2 5/9] mtd: spi-nor-core: Don't check for zero length in spi_nor_erase() Message-ID: <20211001103028.cmptdvfgwemxfc6f@ti.com> References: <20210925173318.25804-1-kabel@kernel.org> <20210925173318.25804-6-kabel@kernel.org> <20210928165909.mw627irdzzn743zg@ti.com> <20211001112513.645b149b@thinkpad> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20211001112513.645b149b@thinkpad> User-Agent: NeoMutt/20171215 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On 01/10/21 11:25AM, Marek Behún wrote: > On Tue, 28 Sep 2021 22:29:11 +0530 > Pratyush Yadav wrote: > > > On 25/09/21 07:33PM, Marek Behún wrote: > > > From: Marek Behún > > > > > > This check is already done in mtdcore's mtd_erase(), no reason to do > > > this here as well. > > > > But do we always get here via mtd_erase()? What about "sf erase"? I > > looked at the code and I don't see any checks for 0 length there. > > Hello Pratyush, you are right. > > This function is also called from include/spi_flash.h static inline > function spi_flash_erase(), when CONFIG_IS_ENABLED(DM_SPI_FLASH) is > false. > > I think I should move this test to the static inline imlpementation, > before calling mtd->_erase(). This should be done in the caller at one > place, not in all _erase() implementations. We would do that. Or we could just leave it here. I don't see it doing much harm. -- Regards, Pratyush Yadav Texas Instruments Inc.