From: Dmitry Rokosov Date: Thu, 19 Dec 2024 21:42:09 +0000 (+0300) Subject: fdt_support: board_fdt_chosen_bootargs() should return const char* X-Git-Tag: v2025.04-rc1~58^2~1 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c39257c131f9110aae6c080f962870ae64043880;p=pandora-u-boot.git fdt_support: board_fdt_chosen_bootargs() should return const char* It should be structured this way to demonstrate to the caller that freeing the return value is unnecessary and that the caller cannot modify it. The function fdt_setprop() includes a parameter with a const char* prototype, so it is better to use the const qualifier. Signed-off-by: Dmitry Rokosov Reviewed-by: Heinrich Schuchardt --- diff --git a/boot/fdt_support.c b/boot/fdt_support.c index 2392027d40b..2c39b2dd14b 100644 --- a/boot/fdt_support.c +++ b/boot/fdt_support.c @@ -321,7 +321,7 @@ int fdt_kaslrseed(void *fdt, bool overwrite) * board_fdt_chosen_bootargs - boards may override this function to use * alternative kernel command line arguments */ -__weak char *board_fdt_chosen_bootargs(void) +__weak const char *board_fdt_chosen_bootargs(void) { return env_get("bootargs"); } @@ -331,7 +331,7 @@ int fdt_chosen(void *fdt) struct abuf buf = {}; int nodeoffset; int err; - char *str; /* used to set string properties */ + const char *str; /* used to set string properties */ err = fdt_check_header(fdt); if (err < 0) { diff --git a/include/fdt_support.h b/include/fdt_support.h index ed4f5ba26c1..f481881ce64 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -236,7 +236,7 @@ int board_rng_seed(struct abuf *buf); * * Return: pointer to kernel command line arguments in memory */ -char *board_fdt_chosen_bootargs(void); +const char *board_fdt_chosen_bootargs(void); /* * The keystone2 SOC requires all 32 bit aliased addresses to be converted