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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26726C433F5 for ; Fri, 1 Oct 2021 09:25:28 +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 83AB561350 for ; Fri, 1 Oct 2021 09:25:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 83AB561350 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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 E0CE981FA9; Fri, 1 Oct 2021 11:25:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="ap3xmVwx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 98A5682C30; Fri, 1 Oct 2021 11:25:23 +0200 (CEST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (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 CD4148187B for ; Fri, 1 Oct 2021 11:25:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: by mail.kernel.org (Postfix) with ESMTPSA id 7F0F161A51; Fri, 1 Oct 2021 09:25:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633080318; bh=wzeBS7wXpbtL8pwrnX4utQvqqFGpNbRbE5KCkiyFmLU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ap3xmVwxBjg6lR9otGT6C2GiVWW+Y2sr5m9M6NkIkZ/ypNBoeUPOKvLm5yIqKcK/J TWv3eHVvIcW5APa9VegyfaZ/Npo3Xp8sU795xs/3ujMtGKKtVxj9u7rIpgyNCeaYVo PCz7wTF4BiJyn5ZAbHtNb8SgQyK+18lUKDDGGg2Jlhlk2TQqfk1GkW50WD0elly0Nd f3XxTMo5t3rR8k9W+H5Wp29rvxpolt4xtqUtyoraeNSJKk6EylbswhJjjusoUYTQuN jsznhce3stixHugyMcyjm1WJrNA+4ueaybNZ3cOlWyYmIS7rCLhqh9gGo8oFfph9Wy SASdhn7ENKKGQ== Date: Fri, 1 Oct 2021 11:25:13 +0200 From: Marek =?UTF-8?B?QmVow7pu?= To: Pratyush Yadav Cc: Jagan Teki , Tom Rini , , Patrick Delaunay , Pali =?UTF-8?B?Um9ow6Fy?= , Patrice Chotard , Marek Vasut , Marek =?UTF-8?B?QmVow7pu?= , 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: <20211001112513.645b149b@thinkpad> In-Reply-To: <20210928165909.mw627irdzzn743zg@ti.com> References: <20210925173318.25804-1-kabel@kernel.org> <20210925173318.25804-6-kabel@kernel.org> <20210928165909.mw627irdzzn743zg@ti.com> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 Tue, 28 Sep 2021 22:29:11 +0530 Pratyush Yadav wrote: > On 25/09/21 07:33PM, Marek Beh=C3=BAn wrote: > > From: Marek Beh=C3=BAn > >=20 > > This check is already done in mtdcore's mtd_erase(), no reason to do > > this here as well. =20 >=20 > But do we always get here via mtd_erase()? What about "sf erase"? I=20 > 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. Marek