[{"id":3683637,"web_url":"http://patchwork.ozlabs.org/comment/3683637/","msgid":"<CAFLszTjRoWbfF2tTt8zzsu6UdWU9fkHzn24WZ8LgDx8Nn+hzyw@mail.gmail.com>","list_archive_url":null,"date":"2026-04-28T18:18:42","subject":"Re: [PATCH v2 1/4] fastboot: block: Add device selection syntax","submitter":{"id":6170,"url":"http://patchwork.ozlabs.org/api/people/6170/","name":"Simon Glass","email":"sjg@chromium.org"},"content":"Hi Balaji,\n\nOn 2026-04-27T12:06:41, Balaji Selvanathan\n<balaji.selvanathan@oss.qualcomm.com> wrote:\n> fastboot: block: Add device selection syntax\n>\n> Implement device selection syntax allowing users to specify the\n> target block device using 'N:partition' format, where N is the\n> device number. When no device is specified, the default from\n> CONFIG_FASTBOOT_FLASH_BLOCK_DEVICE_ID is used.\n>\n> Modify fastboot_block_get_part_info() to use the new parsing\n> function, enabling operations like \"fastboot flash 0:boot boot.img\"\n> to write to specific devices while maintaining backward compatibility\n> with the existing \"fastboot flash boot boot.img\" syntax.\n>\n> Example usage:\n>   fastboot flash 0:boot boot.img      # Flash to device 0\n>   fastboot flash 1:system system.img  # Flash to device 1\n>   fastboot flash boot boot.img        # Use default device\n>\n> Signed-off-by: Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>\n>\n> drivers/fastboot/fb_block.c | 53 +++++++++++++++++++++++++++++++++++++++++----\n>  1 file changed, 49 insertions(+), 4 deletions(-)\n\n> diff --git a/drivers/fastboot/fb_block.c b/drivers/fastboot/fb_block.c\n> @@ -133,25 +172,31 @@ int fastboot_block_get_part_info(const char *part_name,\n>       *dev_desc = blk_get_dev(interface, device);\n> -     if (!dev_desc) {\n> +     if (!*dev_desc) {\n>               fastboot_fail(\"no such device\", response);\n>               return -ENODEV;\n>       }\n\nThis is a real bug fix - the old test could never fail since dev_desc\nis the address of a local pointer - but it is unrelated to the\ndevice-selection syntax. Please split it into its own patch at the\nstart of the series so it is easy to backport.\n\n> diff --git a/drivers/fastboot/fb_block.c b/drivers/fastboot/fb_block.c\n> @@ -124,6 +125,44 @@ static lbaint_t fb_block_sparse_reserve(struct sparse_storage *info,\n> +     /* Override if device:partition format detected */\n> +     if (colon_pos && colon_pos > part_name) {\n> +             *device = simple_strtoul(part_name, NULL, 10);\n\nsimple_strtoul() with a NULL endp silently accepts anything -\n'foo:boot' parses as device 0 and quietly writes to the default\ndevice, which is exactly the surprise the new syntax is meant to\navoid. Please pass an endp and reject input where the consumed length\ndoesn't reach colon_pos, so a malformed prefix becomes -EINVAL.\ndectoul() is preferred over simple_strtoul(..., 10) in new code.\n\n> diff --git a/drivers/fastboot/fb_block.c b/drivers/fastboot/fb_block.c\n> @@ -124,6 +125,44 @@ static lbaint_t fb_block_sparse_reserve(struct sparse_storage *info,\n> +static int parse_device_partition(const char *part_name, int *device,\n> +                               const char **partition_name)\n\nU-Boot already uses dev:partnum for partition numbers\n(part_get_info_by_dev_and_name_or_num() - '0:1' means device 0,\npartition 1) and dev#partname for names. Reusing ':' for a name lookup\nmeans '0:1' becomes ambiguous on boards that label partitions\nnumerically. How about '#' instead, to match the rest of the disk\nlayer?\n\n> diff --git a/drivers/fastboot/fb_block.c b/drivers/fastboot/fb_block.c\n> @@ -124,6 +125,44 @@ static lbaint_t fb_block_sparse_reserve(struct sparse_storage *info,\n> + * @partition_name: Output partition name pointer (can be NULL)\n\nJust to clarify, the kernel-doc says partition_name can be NULL but\nevery caller in this patch passes non-NULL - the NULL handling only\nbecomes useful in patch 3, so please move it to the patch that needs\nit, so each patch is self-contained.\n\nRegards,\nSimon","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256\n header.s=google header.b=k6cnUu4Q;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=chromium.org","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=chromium.org header.i=@chromium.org\n header.b=\"k6cnUu4Q\";\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=chromium.org","phobos.denx.de;\n spf=pass smtp.mailfrom=sjg@chromium.org"],"Received":["from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4pbm6yP2z1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 04:19:00 +1000 (AEST)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id DCB7184686;\n\tTue, 28 Apr 2026 20:18:58 +0200 (CEST)","by phobos.denx.de (Postfix, from userid 109)\n id 27FB28468B; Tue, 28 Apr 2026 20:18:58 +0200 (CEST)","from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com\n [IPv6:2a00:1450:4864:20::62a])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 74A9E8467F\n for <u-boot@lists.denx.de>; Tue, 28 Apr 2026 20:18:55 +0200 (CEST)","by mail-ej1-x62a.google.com with SMTP id\n a640c23a62f3a-b8f9568e074so1937315966b.0\n for <u-boot@lists.denx.de>; Tue, 28 Apr 2026 11:18:55 -0700 (PDT)"],"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,DKIMWL_WL_HIGH,\n DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,\n RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham\n autolearn_force=no version=3.4.2","ARC-Seal":"i=1; a=rsa-sha256; t=1777400335; cv=none;\n d=google.com; s=arc-20240605;\n b=Nvs4fsgClEfHXJCIVAcpFJMlSchWcxlSwvAq8vdp4/EwS/9IyxsBAMFvYd2Hs79Lup\n oLOINp4mWx5GPVbjOOM048IWOHxJGcKn+Q2u28W744R64qUaS38funY69YdYTligoHJU\n A4bMDK28Mp+5GvJOJwg1I1Xv8Nms4aSKWYWhSiXQp7rrW/JX4GQHBXbbedRdt6d3Djo/\n buo54FwUhAT/qsZuU5b3A/7Zhhjne8UREdF+OFOCT5G78P7zdZk8WRpxp+CQiYlJhnN6\n TDl1CCEMPm15c9KfROX5qRBF4oGGGiQkbKRDau1LHwJfgAB6peBuK7KItBsrOed6cweG\n 3WGw==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n h=cc:to:subject:message-id:date:from:in-reply-to:references\n :mime-version:dkim-signature;\n bh=DPl8QXStgdaY/Qx08CT86mKN4XwM83IDIULAxJEdELg=;\n fh=FSZLg1kBZKtmq7hkO96s8J8bywdf/NrVlQg027zGQAY=;\n b=Vn6aE1ZmVfVoJ16nJ5BRpHlFPFy0vdVEgKvEfU/yAf6SZ8A0U/pYLgHBzL8CQjQWo8\n xmISXk2pn3HFm24J29wRrpg4KfWcaYeqS8pV8qKYhh+q+f08ZJexXQPuJ5NVVM/7v4+V\n 895YLH98KyWfMI3GlV2rbdDwRWRZvolhqixkll16u8rLCgnI3lTvQ1DnXxZwXf9X1m61\n hq738oTpykC26BEqy2BQ15LZe2bbmj0R4a6ItpszdWRcycNVi4OIqCuH+IN0BiqcUjd+\n WkYI7InjnKSSn2rmQq7MhncbMy40hG45YRRIMGTa3mSQ6vS1l4maisRtUpAPOFMgzYJ7\n W3kQ==; darn=lists.denx.de","ARC-Authentication-Results":"i=1; mx.google.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=chromium.org; s=google; t=1777400335; x=1778005135; darn=lists.denx.de;\n h=cc:to:subject:message-id:date:from:in-reply-to:references\n :mime-version:from:to:cc:subject:date:message-id:reply-to;\n bh=DPl8QXStgdaY/Qx08CT86mKN4XwM83IDIULAxJEdELg=;\n b=k6cnUu4QvP9C6dzgebmATjnS2t/3oV4s5SfkfHqnnnH7Du3UeL8dX4e0BX7jzg4mwt\n cG5L0BvAQhfNmuAuXmXH22CKziDEOVyN/+7YK+Vk4yfoM40UQM7wb4GEjeGnkBHRnQ8d\n PVHFODj9i9ijkpEeSfXoC75jTAm1BskdbJe10=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777400335; x=1778005135;\n h=cc:to:subject:message-id:date:from:in-reply-to:references\n :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=DPl8QXStgdaY/Qx08CT86mKN4XwM83IDIULAxJEdELg=;\n b=TB4W9vqpPscbFFskc/yRc+fOCpsYSaDYsqYk0w7NAkuRAkZ+PK+J6UIvDmdqZMeRI4\n b6dJ/ZhiMzf0t5nGRd3Eg9unklvVY+psjygospuJFMSruDRsPSuvl50axOZ4SUeVJ2I6\n J5ueFXmhOCjYjpfbXwn0i6VLAOy7RTpbSueRyqqQQ0rhDfZ8tKHQ9CQqA57JzsLybqq3\n yapVsLdE1ejwmgHL6yCC1ime4WkxRBRIMNbdHglyFlo2+NPqaV/9LPf0M/leRmJkE4nZ\n dg+kdi62TWFeBBh3aJofL1DahkBnjtEVMKCBrwLmFO5DAbhKBiMgrB7qOWkwnV4kZ73l\n lTog==","X-Gm-Message-State":"AOJu0YzXhvjc+YKWba7FpxKH4hh2Qp3nDjbMpvs/CNnbXSb31I29Wokx\n KxS0upXg6YxWV5RPCcM2vve2O/45JxwxmwNFgg7g+4Icem63wNehoEIc2TMYe/7ztUtCFQi04uv\n wM2ynt9bYGihupOoH1fGigQRJYzqjnZs6sTB73049","X-Gm-Gg":"AeBDieu1/iTFPvu1YHL0/1Idl6075sHjoN085re7AceVh6MhzQ27abnJVuHlaKyUBVI\n 09hShtn8KdUncrX4tekMN56hghxY5g13WyrwUzs7NFDNFB+zQjo1Z3huFKd6BiMEF2MDIOTLU1j\n xKtmbgovyDR4bMDuke9+wvHDO0xjDEvTHMCNlGLBLJBHt23X0OqFT/CmSnZdEF+mfvr0WplAsvw\n wVm3S0GBjp8Y5aSJ/8sYxjNSGM0Ciz+SyGPF3c3S5r3AkHwfEn8YsqOo4Yi7iGKnJYJymb80Xqt\n /hl6fIFqS4a/Ggoc","X-Received":"by 2002:a17:907:e146:b0:bac:6d85:255c with SMTP id\n a640c23a62f3a-bb801bce7d6mr176655966b.21.1777400334809; Tue, 28 Apr 2026\n 11:18:54 -0700 (PDT)","MIME-Version":"1.0","References":"<20260427-fb_gpt-v2-0-9e7fe3c1649a@oss.qualcomm.com>\n <20260427-fb_gpt-v2-1-9e7fe3c1649a@oss.qualcomm.com>","In-Reply-To":"<20260427-fb_gpt-v2-1-9e7fe3c1649a@oss.qualcomm.com>","From":"Simon Glass <sjg@chromium.org>","Date":"Tue, 28 Apr 2026 12:18:42 -0600","X-Gm-Features":"AVHnY4If9Cs7KEYoc175YfIk6wqZmbNHZBSvc_kxvbPcbLgraIquDcClKH89xbo","Message-ID":"\n <CAFLszTjRoWbfF2tTt8zzsu6UdWU9fkHzn24WZ8LgDx8Nn+hzyw@mail.gmail.com>","Subject":"Re: [PATCH v2 1/4] fastboot: block: Add device selection syntax","To":"balaji.selvanathan@oss.qualcomm.com","Cc":"u-boot@lists.denx.de, Mattijs Korpershoek <mkorpershoek@kernel.org>,\n Tom Rini <trini@konsulko.com>, Heiko Schocher <hs@nabladev.com>,\n Neil Armstrong <neil.armstrong@linaro.org>,\n Dmitrii Merkurev <dimorinny@google.com>,\n Adrian Freihofer <adrian.freihofer@siemens.com>, Peng Fan <peng.fan@nxp.com>,\n Jaehoon Chung <jh80.chung@samsung.com>,\n \"Ariel D'Alessandro\" <ariel.dalessandro@collabora.com>","Content-Type":"text/plain; charset=\"UTF-8\"","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.8 at phobos.denx.de","X-Virus-Status":"Clean"}}]