[PATCH v2 2/8] cmd: ubi: mark read-only function parameters with const
Simon Glass
sjg at chromium.org
Wed Apr 22 00:43:39 CEST 2026
On Tue, 21 Apr 2026 at 20:36, Weijie Gao <weijie.gao at mediatek.com> wrote:
>
> Parameters like part/volume name and buffer for writing are not being
> modified by the callee functions and should be marked const.
>
> Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
> ---
> v2: new
> ---
> cmd/ubi.c | 41 ++++++++++++++++++++++-------------------
> include/ubi_uboot.h | 7 ++++---
> 2 files changed, 26 insertions(+), 22 deletions(-)
>
Reviewed-by: Simon Glass <sjg at chromium.org>
> diff --git a/include/ubi_uboot.h b/include/ubi_uboot.h
> index 05fb9634d81..a949d1b80dd 100644
> --- a/include/ubi_uboot.h
> +++ b/include/ubi_uboot.h
> @@ -47,9 +47,10 @@
> int ubi_mtd_param_parse(const char *val, struct kernel_param *kp);
> int ubi_init(void);
> void ubi_exit(void);
> -int ubi_part(char *part_name, const char *vid_header_offset);
> -int ubi_volume_write(char *volume, void *buf, loff_t offset, size_t size);
> -int ubi_volume_read(char *volume, char *buf, loff_t offset, size_t size);
> +int ubi_part(const char *part_name, const char *vid_header_offset);
> +int ubi_volume_write(const char *volume, const void *buf, loff_t offset,
> + size_t size);
> +int ubi_volume_read(const char *volume, char *buf, loff_t offset, size_t size);
>
> extern struct ubi_device *ubi_devices[];
> int cmd_ubifs_mount(char *vol_name);
> --
> 2.45.2
>
It would be nice to have proper comments for these functions.
Regards,
Simon
More information about the U-Boot
mailing list