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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 C5B2CC2B9F4 for ; Fri, 25 Jun 2021 13:08:00 +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 065FD61941 for ; Fri, 25 Jun 2021 13:08:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 065FD61941 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech 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 20AC582C3C; Fri, 25 Jun 2021 15:06:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=cerno.tech 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=cerno.tech header.i=@cerno.tech header.b="aNZ299OA"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="tGkXz7P8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3DB0082C28; Fri, 25 Jun 2021 15:06:18 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1F31E82C1E for ; Fri, 25 Jun 2021 15:06:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=cerno.tech Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=maxime@cerno.tech Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 5151A5C0101; Fri, 25 Jun 2021 09:06:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 25 Jun 2021 09:06:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=lBB49ynl3TGEp +aPQIHg8pJ3pUKwQg/CLK2cZi/lFVI=; b=aNZ299OAaYpbCS+LqozYav8gtY662 r+42wzvKt7KMnACsODvA1vVWV31v3kmvqeGynXvrU+4j1jBDuPEPlSUvEyJji4uI ZOrOLhnNzd86XnV8wZM/TjNwr8BTjITqZRRi1LC6V1iW8Y5zHmQlEdg7eLGW0w65 rIN32A4pAJlKj2jAjlaL8VlIAYu3jfvJHBruc6kLsnGUO0zhFF/i4P0xCx8fHOUR utfTzb0uXDEFu92SBlOg2jFlLfsyxH4Gbsp5eRdP3wggil71Ej5JdpVmHR9U2324 pWEcbwjX2R1WxGmuh3lPjque4t0VshzoUjIg/wPV8vDoPabK5u4yLm1Tg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=lBB49ynl3TGEp+aPQIHg8pJ3pUKwQg/CLK2cZi/lFVI=; b=tGkXz7P8 9O84mo11BtCRIn+mz++hqFr2kTwKbKCHV2HIymIURzc8qV6aOEtoMrWgpjho3nNR t8pMJpHUUcwXDw5vrHTtVfxuScYeXXmuy1smjC5PwEoY4Xtd/7rLuXMrqvglAdqo NxCjAoCCzVL581F5gCFBU1frUQ6osMmWA2LLyMCXKMwvVeLRZubcHaeh/mPrbT5U 3+nU3RDp+LxukQ4W76E07hdnQNsagIbck+ozZV1Ustbhj+DTI0ugLqPNMbdH0dhq aKd+EEJXPeUGBbQgSTEpnql2I1l9LzGsnu+iGm1gL/Bbgp81gDeSH46TVSeSd/Cb Y5oCYptX2xnCjQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeegjedgheehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepmh grgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 25 Jun 2021 09:06:06 -0400 (EDT) From: Maxime Ripard To: u-boot@lists.denx.de, Andre Przywara Cc: Peng Fan , Li Jun , Marek Vasut , Tom Rini , Miquel Raynal , Jagan Teki , Maxime Ripard Subject: [PATCH 09/12] fastboot: nand: Fix return error code Date: Fri, 25 Jun 2021 15:05:44 +0200 Message-Id: <20210625130547.2177920-10-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210625130547.2177920-1-maxime@cerno.tech> References: <20210625130547.2177920-1-maxime@cerno.tech> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 --- 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) { -- 2.31.1