From patchwork Wed Nov 13 05:05:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 842875 Delivered-To: patch@linaro.org Received: by 2002:a5d:6392:0:b0:381:e71e:8f7b with SMTP id p18csp23824wru; Tue, 12 Nov 2024 21:06:24 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXkkch3sBIDAuZsnf1Ui3h/OTBZkUApE3pD2m1VhwhlADxqi3GRcal8L7+iBpB/iAdJ5XPKhw==@linaro.org X-Google-Smtp-Source: AGHT+IHfI2aXcx4YbcTcO7wZIElJyAKoX1XN9VpV2BGiM+wDqvqCUb2SUUxFhas6qkFl7HfsjQbE X-Received: by 2002:a17:906:f5a3:b0:a99:f833:ca32 with SMTP id a640c23a62f3a-a9eefee8d20mr1892963066b.18.1731474383833; Tue, 12 Nov 2024 21:06:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731474383; cv=none; d=google.com; s=arc-20240605; b=Bw/zwsYl4Lfkod7uqEh+hZZjyK1bUXmY7c+vsRPak3ii4srx9eiKlEo40cQ3hr3pcI 042jLOGTSc9M/9y0qhZMRXPdLCu1sueeNiXS68COOvWrvKqQ1MU4RdcBgdXF3NjYKbbl HlYr5ggunjtDbOMxBk6RTSiowGlwyg49bWPb45kdnls3eHLvjKHVSoym1Xiwfsl8mWUh ShMmhbe+3PEBQhasFYLQKpePP0Np4QvaHDRAf+uCBtMrwq6MaQggYd4JiYtvjYs9wwi7 19XvGp7/hA2NGTszoWjkBjzTMzWr66YwXxsBaFrVIgsadBF8WE1u9yG62sNOEcJLo4ss 4p8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=wAX5Ef2SrOxGF+xYVjbG4OIUse+l2G80GuismvHqiWE=; fh=RLMrmYH/QnzHZsOgi6tcfeNqManBCB7L9rPOiCPqu2k=; b=jEUFCCAB6j1XY+haz6KzFiVb9gfwy8eYBPdBm5y1e1yrZxrg6z2x5BTmUZaboMNpIv D72fIK0Ae1Ni3sPSqBCS28b6OGYGTAU3DK8ysC8uHirgWmoSlYFUqHSo75koya/wEWKA pX3BJHGLvabX3sSSvsQMImGUZrUH0Gno3SSJFHvz+ukvr/nkOv1GW7wzbe9dE05RPjU2 bFUHfx2QI8YP/gTQyOEAu2Ud5nAKQX4+nZXvB0cc7oPC/565vyz9BpH3nFXr5E4827Fh 670w7IbuCYwrDLJzn0IAl2rLP6uioYm0EbFuUHce97MuCKFoGa9YSi2hRqxkAI/wR42Y PL6Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="wOuNeb/8"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-a9ee0a3865esi883566966b.252.2024.11.12.21.06.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 21:06:23 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="wOuNeb/8"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2B3D688E3F; Wed, 13 Nov 2024 06:06:23 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.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=linaro.org header.i=@linaro.org header.b="wOuNeb/8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2A9CA8952B; Wed, 13 Nov 2024 06:06:22 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1B308884D2 for ; Wed, 13 Nov 2024 06:06:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-5cedf5fe237so7822729a12.3 for ; Tue, 12 Nov 2024 21:06:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731474379; x=1732079179; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=wAX5Ef2SrOxGF+xYVjbG4OIUse+l2G80GuismvHqiWE=; b=wOuNeb/8rAqdEdyAEJkKG/oCXXewFF3k6Smkmbk/7qlsZRqWzW+jH4/HvT6vwcL7zN aMD7HVYLifbnfwoM2F7CKLIJpQl7SL8NDlEVg7qCcy+zS4B9ntJ5XmbC7avYj5a/QnP/ g/KekO7QYaKOFPpgZ3bqwI39AsdN3erkQWID5vad1uUrO+J7hQRXrab135uvVf01Zz7c m9xz5vKvq5+l+/v11ilHivCr9pzsNQlGb8ZFR8jGJadK3PXiBEHg08i81mwz1+bPf8B8 PxGr+21/Gn4/o1U8UNql2GnEhXbnalWa9n8LCPVYUf3MGLWl03qIAyCAJULG9M46+Mul x7YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731474379; x=1732079179; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wAX5Ef2SrOxGF+xYVjbG4OIUse+l2G80GuismvHqiWE=; b=Zr/MPrGwD+AnlI3DzTWbB0F/RVQeYu7YvA3H3iz+xch6MhzCKBd7EKt7LvGnqVofaQ 382ZUKrmSomjxmNLKtGaKcl4tOas/7hopIvBlux8G63eNFZSwYim2RTnyVA4BWbtYEDX DyKZrPFQ9wGsdY7KAaAPKoAISCaf6GwGMRfbNifyZmLOzmYMiXeYbcHC86eoXbjt164T wW/6koMJxuyYB3UDPgHrvmCTAjzSdTOs99EAiw6DAZBl2R+oWT2eeG2ByffZMLohdvbA QcNR8O0b4AjpjTfAmQ/lrXBmOvHVjvdKeM5QfcfUbsbQHnMUVuYKYhsJxRvzY0m7RrZb ZpiA== X-Gm-Message-State: AOJu0YzzK9lYziyem1oEs1DMLKVVNkO2ob5Gmv9RxrNmb74g9IohySRn /s8gPj7zVlY4FGJNJe2ajLDGK85H+nHwweNlVNwaONIqd0WlW9jq5DMMJUS9Wi4= X-Received: by 2002:a05:6402:1d4b:b0:5c9:5e43:9480 with SMTP id 4fb4d7f45d1cf-5cf0a310c43mr11753368a12.7.1731474379542; Tue, 12 Nov 2024 21:06:19 -0800 (PST) Received: from lion.caleb.rex.connolly.tech ([2a02:8109:888d:ff00:ca7f:54ff:fe52:4519]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cf03c7ce0asm6727970a12.85.2024.11.12.21.06.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 21:06:18 -0800 (PST) From: Caleb Connolly To: Caleb Connolly , Ion Agorria , Mattijs Korpershoek , Svyatoslav Ryhel , Tom Rini Cc: u-boot@lists.denx.de Subject: [PATCH] fastboot: properly handle unknown partition type Date: Wed, 13 Nov 2024 06:05:59 +0100 Message-ID: <20241113050607.1850472-1-caleb.connolly@linaro.org> X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean In getvar_partition_type() we attempt to find a filesystem driver for the partition (of the list of driver enabled in U-Boot), on failure we return the error to fastboot and completely bail out of the operation. However, this should not be a failure, instead we should just default to "raw". This allows commands like "fastboot format:ext4 userdata" to work if userdata didn't already have an ext4 partition table (or if FS_EXT4 is disabled in U-Boot), as failing to determine the current partition type is not an error in this case. Signed-off-by: Caleb Connolly Reviewed-by: Mattijs Korpershoek --- drivers/fastboot/fb_getvar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c index 93cbd598e024..9c2ce65a4e5b 100644 --- a/drivers/fastboot/fb_getvar.c +++ b/drivers/fastboot/fb_getvar.c @@ -229,9 +229,10 @@ static void __maybe_unused getvar_partition_type(char *part_name, char *response response); if (r >= 0) { r = fs_set_blk_dev_with_part(dev_desc, r); if (r < 0) - fastboot_fail("failed to set partition", response); + /* If we don't know then just default to raw */ + fastboot_okay("raw", response); else fastboot_okay(fs_get_type_name(), response); } }