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 EDE72C433EF for ; Tue, 28 Sep 2021 16:59:30 +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 4284161262 for ; Tue, 28 Sep 2021 16:59:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4284161262 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 2881A80C58; Tue, 28 Sep 2021 18:59:27 +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="FJyLiK6L"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 55A9C8312A; Tue, 28 Sep 2021 18:59:25 +0200 (CEST) Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (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 C7C9380397 for ; Tue, 28 Sep 2021 18:59:21 +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 fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 18SGxDbH046765; Tue, 28 Sep 2021 11:59:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1632848353; bh=GU69sPhYTe6iBUpj7wKgz/ByU/EDNjb5vSZsQe5IIOo=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=FJyLiK6Ljr5+luT5/jkglivCIqJ52F9ygtdSc2ms+DdlmR9Q6QmstLIhOU0e0/lG+ 2+4qijqR7vVct3s5oDvqgE70lLAIVZxTrpkhJPIOwwHAWuwPbVJX/Dgxz2iF19OiFy NlNUuAESSh0X48vtFeTPLrqsctC7ectRb+FeZbIA= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 18SGxDLq013892 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 Sep 2021 11:59:13 -0500 Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Tue, 28 Sep 2021 11:59:13 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE108.ent.ti.com (157.170.170.38) 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; Tue, 28 Sep 2021 11:59:12 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 18SGxCWj078406; Tue, 28 Sep 2021 11:59:12 -0500 Date: Tue, 28 Sep 2021 22:29:11 +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: <20210928165909.mw627irdzzn743zg@ti.com> References: <20210925173318.25804-1-kabel@kernel.org> <20210925173318.25804-6-kabel@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210925173318.25804-6-kabel@kernel.org> 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 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. > > Signed-off-by: Marek Behún > Reviewed-by: Simon Glass > Tested-by: Masami Hiramatsu > --- > drivers/mtd/spi/spi-nor-core.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c > index 9e936cbe1a..211eea22a4 100644 > --- a/drivers/mtd/spi/spi-nor-core.c > +++ b/drivers/mtd/spi/spi-nor-core.c > @@ -912,9 +912,6 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr) > dev_dbg(nor->dev, "at 0x%llx, len %lld\n", (long long)instr->addr, > (long long)instr->len); > > - if (!instr->len) > - return 0; > - > div_u64_rem(instr->len, mtd->erasesize, &rem); > if (rem) > return -EINVAL; > -- > 2.32.0 > -- Regards, Pratyush Yadav Texas Instruments Inc.