{"id":2225585,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2225585/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/d58f3c216c5f64a11afa9ea3e32e543abab208f7.1776759754.git.weijie.gao@mediatek.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.2/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<d58f3c216c5f64a11afa9ea3e32e543abab208f7.1776759754.git.weijie.gao@mediatek.com>","list_archive_url":null,"date":"2026-04-21T08:35:56","name":"[v2,2/8] cmd: ubi: mark read-only function parameters with const","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"8dfdad9c38ed86d82dff164b61682324860fecfc","submitter":{"id":75269,"url":"http://patchwork.ozlabs.org/api/1.2/people/75269/?format=json","name":"Weijie Gao","email":"weijie.gao@mediatek.com"},"delegate":{"id":1691,"url":"http://patchwork.ozlabs.org/api/1.2/users/1691/?format=json","username":"hs","first_name":"Heiko","last_name":"Schocher","email":"hs@denx.de"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/d58f3c216c5f64a11afa9ea3e32e543abab208f7.1776759754.git.weijie.gao@mediatek.com/mbox/","series":[{"id":500759,"url":"http://patchwork.ozlabs.org/api/1.2/series/500759/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=500759","date":"2026-04-21T08:35:39","name":"Add support for ubi environment to create volumes","version":2,"mbox":"http://patchwork.ozlabs.org/series/500759/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2225585/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2225585/checks/","tags":{},"related":[],"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=mediatek.com header.i=@mediatek.com header.a=rsa-sha256\n header.s=dk header.b=sZ7eMoEG;\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=quarantine dis=none) header.from=mediatek.com","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=mediatek.com header.i=@mediatek.com\n header.b=\"sZ7eMoEG\";\n\tdkim-atps=neutral","phobos.denx.de; dmarc=pass (p=quarantine dis=none)\n header.from=mediatek.com","phobos.denx.de;\n spf=pass smtp.mailfrom=weijie.gao@mediatek.com"],"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 4g0G0b4JMMz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Apr 2026 18:36:15 +1000 (AEST)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id F025C843D0;\n\tTue, 21 Apr 2026 10:36:10 +0200 (CEST)","by phobos.denx.de (Postfix, from userid 109)\n id 13970843D0; Tue, 21 Apr 2026 10:36:07 +0200 (CEST)","from mailgw01.mediatek.com (unknown [60.244.123.138])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id AD8BB84258\n for <u-boot@lists.denx.de>; Tue, 21 Apr 2026 10:36:04 +0200 (CEST)","from mtkmbs09n2.mediatek.inc [(172.21.101.94)] by\n mailgw01.mediatek.com (envelope-from <weijie.gao@mediatek.com>)\n (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256)\n with ESMTP id 247255128; Tue, 21 Apr 2026 16:36:01 +0800","from mtkmbs13n1.mediatek.inc (172.21.101.193) by\n MTKMBS14N1.mediatek.inc (172.21.101.75) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n 15.2.2562.29; Tue, 21 Apr 2026 16:35:59 +0800","from mcddlt001.gcn.mediatek.inc (10.19.240.15) by\n mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id\n 15.2.2562.29 via Frontend Transport; Tue, 21 Apr 2026 16:35:59 +0800"],"X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,\n RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RDNS_NONE,SPF_HELO_PASS,SPF_PASS,\n UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.2","X-UUID":["208f924e3d5d11f19781c1a04af40193-20260421","208f924e3d5d11f19781c1a04af40193-20260421"],"DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n d=mediatek.com;\n s=dk;\n h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From;\n bh=F1CrNi9d4LICXUjYecQzq9uml4IyXCLWmFgP9kaEoOA=;\n b=sZ7eMoEG+jHgKA8fKM87hv9kjcM/K1StAx8UT2mNuXzBjCWZVVwa9W11XjFUhDgnBcUiPqAKYXe9eSdJbL9jSXAEdFwnjOLlWpfqPX2drkM8ID91JgL6vTQsDXEbvya7UjqoswBiDOAZiCedah9NStUnR+y5rGLETIvsDDxsKrk=;","X-CID-P-RULE":"Release_Ham","X-CID-O-INFO":"VERSION:1.3.12, REQID:3191231e-745b-42e3-8e24-f7e1357c5d23,\n IP:0,\n U\n RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO\n N:release,TS:-25","X-CID-META":"VersionHash:e7bac3a, CLOUDID:43103095-f8ef-4ca8-bea0-143568f9ca1d,\n B\n ulkID:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|836|865|888|898,TC:-5,Cont\n ent:0|15|50,EDM:-3,IP:nil,URL:0,File:130,RT:0,Bulk:nil,QS:nil,BEC:-1,COL:0\n ,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0","X-CID-BVR":"2,SSN|SDN","X-CID-BAS":"2,SSN|SDN,0,_","X-CID-FACTOR":"TF_CID_SPAM_SNR","X-CID-RHF":"D41D8CD98F00B204E9800998ECF8427E","From":"Weijie Gao <weijie.gao@mediatek.com>","To":"<u-boot@lists.denx.de>","CC":"GSS_MTK_Uboot_upstream <GSS_MTK_Uboot_upstream@mediatek.com>, Tom Rini\n <trini@konsulko.com>, Marek Vasut <marek.vasut+renesas@mailbox.org>, Simon\n Glass <sjg@chromium.org>, Weijie Gao <weijie.gao@mediatek.com>","Subject":"[PATCH v2 2/8] cmd: ubi: mark read-only function parameters with\n const","Date":"Tue, 21 Apr 2026 16:35:56 +0800","Message-ID":"\n <d58f3c216c5f64a11afa9ea3e32e543abab208f7.1776759754.git.weijie.gao@mediatek.com>","X-Mailer":"git-send-email 2.17.0","In-Reply-To":"<cover.1776759754.git.weijie.gao@mediatek.com>","References":"<cover.1776759754.git.weijie.gao@mediatek.com>","MIME-Version":"1.0","Content-Type":"text/plain","X-MTK":"N","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"},"content":"Parameters like part/volume name and buffer for writing are not being\nmodified by the callee functions and should be marked const.\n\nSigned-off-by: Weijie Gao <weijie.gao@mediatek.com>\n---\nv2: new\n---\n cmd/ubi.c           | 41 ++++++++++++++++++++++-------------------\n include/ubi_uboot.h |  7 ++++---\n 2 files changed, 26 insertions(+), 22 deletions(-)","diff":"diff --git a/cmd/ubi.c b/cmd/ubi.c\nindex 93de6f3aea2..f75ceff11ee 100644\n--- a/cmd/ubi.c\n+++ b/cmd/ubi.c\n@@ -39,7 +39,7 @@ static struct ubi_device *ubi;\n #include <ubifs_uboot.h>\n #endif\n \n-static void display_volume_info(struct ubi_device *ubi)\n+static void display_volume_info(const struct ubi_device *ubi)\n {\n \tint i;\n \n@@ -50,7 +50,7 @@ static void display_volume_info(struct ubi_device *ubi)\n \t}\n }\n \n-static void display_ubi_info(struct ubi_device *ubi)\n+static void display_ubi_info(const struct ubi_device *ubi)\n {\n \tubi_msg(\"MTD device name:            \\\"%s\\\"\", ubi->mtd->name);\n \tubi_msg(\"MTD device size:            %llu MiB\", ubi->flash_size >> 20);\n@@ -149,12 +149,12 @@ static int ubi_list(const char *var, int numeric)\n \treturn 0;\n }\n \n-static int ubi_check_volumename(const struct ubi_volume *vol, char *name)\n+static int ubi_check_volumename(const struct ubi_volume *vol, const char *name)\n {\n \treturn strcmp(vol->name, name);\n }\n \n-static int ubi_check(char *name)\n+static int ubi_check(const char *name)\n {\n \tint i;\n \n@@ -213,8 +213,8 @@ bad:\n \treturn err;\n }\n \n-static int ubi_create_vol(char *volume, int64_t size, int dynamic, int vol_id,\n-\t\t\t  bool skipcheck)\n+static int ubi_create_vol(const char *volume, int64_t size, int dynamic,\n+\t\t\t  int vol_id, bool skipcheck)\n {\n \tstruct ubi_mkvol_req req;\n \tint err;\n@@ -247,7 +247,7 @@ static int ubi_create_vol(char *volume, int64_t size, int dynamic, int vol_id,\n \treturn ubi_create_volume(ubi, &req);\n }\n \n-static struct ubi_volume *ubi_find_volume(char *volume)\n+static struct ubi_volume *ubi_find_volume(const char *volume)\n {\n \tstruct ubi_volume *vol;\n \tint i;\n@@ -262,7 +262,7 @@ static struct ubi_volume *ubi_find_volume(char *volume)\n \treturn NULL;\n }\n \n-static int ubi_remove_vol(char *volume)\n+static int ubi_remove_vol(const char *volume)\n {\n \tint err, reserved_pebs, i;\n \tstruct ubi_volume *vol;\n@@ -316,7 +316,7 @@ out_err:\n \treturn err;\n }\n \n-static int ubi_rename_vol(char *oldname, char *newname)\n+static int ubi_rename_vol(const char *oldname, const char *newname)\n {\n \tstruct ubi_volume *vol;\n \tstruct ubi_rename_entry rename;\n@@ -354,7 +354,8 @@ static int ubi_rename_vol(char *oldname, char *newname)\n \treturn ubi_rename_volumes(ubi, &list);\n }\n \n-static int ubi_volume_continue_write(char *volume, void *buf, size_t size)\n+static int ubi_volume_continue_write(const char *volume, const void *buf,\n+\t\t\t\t     size_t size)\n {\n \tint err;\n \tstruct ubi_volume *vol;\n@@ -394,8 +395,8 @@ static int ubi_volume_continue_write(char *volume, void *buf, size_t size)\n \treturn 0;\n }\n \n-int ubi_volume_begin_write(char *volume, void *buf, size_t size,\n-\tsize_t full_size)\n+int ubi_volume_begin_write(const char *volume, const void *buf, size_t size,\n+\t\t\t   size_t full_size)\n {\n \tint err;\n \tint rsvd_bytes;\n@@ -424,8 +425,8 @@ int ubi_volume_begin_write(char *volume, void *buf, size_t size,\n \treturn ubi_volume_continue_write(volume, buf, size);\n }\n \n-static int ubi_volume_offset_write(char *volume, void *buf, loff_t offset,\n-\t\t\t\t   size_t size)\n+static int ubi_volume_offset_write(const char *volume, const void *buf,\n+\t\t\t\t   loff_t offset, size_t size)\n {\n \tint len, tbuf_size, ret;\n \tu64 lnum;\n@@ -487,7 +488,8 @@ exit:\n \treturn ret;\n }\n \n-int ubi_volume_write(char *volume, void *buf, loff_t offset, size_t size)\n+int ubi_volume_write(const char *volume, const void *buf, loff_t offset,\n+\t\t     size_t size)\n {\n \tint ret;\n \n@@ -503,7 +505,7 @@ int ubi_volume_write(char *volume, void *buf, loff_t offset, size_t size)\n \treturn ret;\n }\n \n-int ubi_volume_read(char *volume, char *buf, loff_t offset, size_t size)\n+int ubi_volume_read(const char *volume, char *buf, loff_t offset, size_t size)\n {\n \tint err, lnum, off, len, tbuf_size;\n \tvoid *tbuf;\n@@ -587,7 +589,8 @@ int ubi_volume_read(char *volume, char *buf, loff_t offset, size_t size)\n \treturn err;\n }\n \n-static int ubi_dev_scan(struct mtd_info *info, const char *vid_header_offset)\n+static int ubi_dev_scan(const struct mtd_info *info,\n+\t\t\tconst char *vid_header_offset)\n {\n \tchar ubi_mtd_param_buffer[80];\n \tint err;\n@@ -611,7 +614,7 @@ static int ubi_dev_scan(struct mtd_info *info, const char *vid_header_offset)\n \treturn 0;\n }\n \n-static int ubi_set_skip_check(char *volume, bool skip_check)\n+static int ubi_set_skip_check(const char *volume, bool skip_check)\n {\n \tstruct ubi_vtbl_record vtbl_rec;\n \tstruct ubi_volume *vol;\n@@ -658,7 +661,7 @@ static int ubi_detach(void)\n \treturn 0;\n }\n \n-int ubi_part(char *part_name, const char *vid_header_offset)\n+int ubi_part(const char *part_name, const char *vid_header_offset)\n {\n \tstruct mtd_info *mtd;\n \tint err;\ndiff --git a/include/ubi_uboot.h b/include/ubi_uboot.h\nindex 05fb9634d81..a949d1b80dd 100644\n--- a/include/ubi_uboot.h\n+++ b/include/ubi_uboot.h\n@@ -47,9 +47,10 @@\n int ubi_mtd_param_parse(const char *val, struct kernel_param *kp);\n int ubi_init(void);\n void ubi_exit(void);\n-int ubi_part(char *part_name, const char *vid_header_offset);\n-int ubi_volume_write(char *volume, void *buf, loff_t offset, size_t size);\n-int ubi_volume_read(char *volume, char *buf, loff_t offset, size_t size);\n+int ubi_part(const char *part_name, const char *vid_header_offset);\n+int ubi_volume_write(const char *volume, const void *buf, loff_t offset,\n+\t\t     size_t size);\n+int ubi_volume_read(const char *volume, char *buf, loff_t offset, size_t size);\n \n extern struct ubi_device *ubi_devices[];\n int cmd_ubifs_mount(char *vol_name);\n","prefixes":["v2","2/8"]}