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 X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE71EC2B9F4 for ; Fri, 25 Jun 2021 14:08:34 +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 0751D6193F for ; Fri, 25 Jun 2021 14:08:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0751D6193F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DE84082C11; Fri, 25 Jun 2021 16:08:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id B90B182C0C; Fri, 25 Jun 2021 16:08:29 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id CC4F382C0A for ; Fri, 25 Jun 2021 16:08:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=andre.przywara@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 18C5B1042; Fri, 25 Jun 2021 07:08:26 -0700 (PDT) Received: from slackpad.fritz.box (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CECE83F694; Fri, 25 Jun 2021 07:08:24 -0700 (PDT) Date: Fri, 25 Jun 2021 15:08:03 +0100 From: Andre Przywara To: Maxime Ripard Cc: u-boot@lists.denx.de, Peng Fan , Li Jun , Marek Vasut , Tom Rini , Miquel Raynal , Jagan Teki Subject: Re: [PATCH 09/12] fastboot: nand: Fix return error code Message-ID: <20210625150803.765ed296@slackpad.fritz.box> In-Reply-To: <20210625130547.2177920-10-maxime@cerno.tech> References: <20210625130547.2177920-1-maxime@cerno.tech> <20210625130547.2177920-10-maxime@cerno.tech> Organization: Arm Ltd. X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.31; x86_64-slackware-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 Fri, 25 Jun 2021 15:05:44 +0200 Maxime Ripard wrote: > Both mtdparts_init() and find_dev_and_part() will return 0 on success > but 1 on failure. > > Since the calling functions of fb_nand_lookup expects a negative error > code on failure, we can't just return the returned value of these > functions. > > This fixes an issue with the logic that detects whether we support > fastboot slots or not by calling fb_nand_lookup and assuming that > anything >= 0 means the partition is there. > > Signed-off-by: Maxime Ripard Yes indeed, good catch! Reviewed-by: Andre Przywara Cheers, Andre > --- > drivers/fastboot/fb_nand.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/fastboot/fb_nand.c b/drivers/fastboot/fb_nand.c > index e07df33d3665..9d832fd8ca9a 100644 > --- a/drivers/fastboot/fb_nand.c > +++ b/drivers/fastboot/fb_nand.c > @@ -44,14 +44,14 @@ static int fb_nand_lookup(const char *partname, > if (ret) { > pr_err("Cannot initialize MTD partitions\n"); > fastboot_fail("cannot init mtdparts", response); > - return ret; > + return -EINVAL; > } > > ret = find_dev_and_part(partname, &dev, &pnum, part); > if (ret) { > pr_err("cannot find partition: '%s'\n", partname); > fastboot_fail("cannot find partition", response); > - return ret; > + return -ENODEV; > } > > if (dev->id->type != MTD_DEV_TYPE_NAND) {