[PATCH v3 4/7] board: tq: common: add sysinfo setup helper
Simon Glass
sjg at chromium.org
Mon Jun 1 23:15:59 CEST 2026
Hi Nora,
On 2026-05-27T09:51:17, Alexander Feilke
<Alexander.Feilke at ew.tq-group.com> wrote:
> board: tq: common: add sysinfo setup helper
>
> Add a setup helper based on the tq_eeprom sysinfo driver
> and set up the U-Boot environment.
>
> Signed-off-by: Nora Schiffer <nora.schiffer at ew.tq-group.com>
> Signed-off-by: Alexander Feilke <alexander.feilke at ew.tq-group.com>
>
> board/tq/common/Kconfig | 5 +++++
> board/tq/common/Makefile | 1 +
> board/tq/common/tq_sysinfo.c | 32 ++++++++++++++++++++++++++++++++
> board/tq/common/tq_sysinfo.h | 15 +++++++++++++++
> 4 files changed, 53 insertions(+)
Reviewed-by: Simon Glass <sjg at chromium.org>
nits below
> diff --git a/board/tq/common/tq_sysinfo.c b/board/tq/common/tq_sysinfo.c
> @@ -0,0 +1,32 @@
> +#include <env.h>
> +#include <sysinfo/tq_eeprom.h>
The .c file does not include its own header tq_sysinfo.h - please add
it so the compiler can check the declaration matches the definition.
The sibling tq_som.c and tq_bb.c follow this pattern.
Also, pr_err() is used below without including <linux/printk.h> or
<log.h>; today it compiles only via transitive includes. Please add
the explicit include - or switch to log_err(), which is preferred for
new U-Boot code.
> diff --git a/board/tq/common/tq_sysinfo.c b/board/tq/common/tq_sysinfo.c
> @@ -0,0 +1,32 @@
> +void tq_common_sysinfo_setup(void)
> +{
> + struct udevice *sysinfo;
> + char buf[MAX_NAME_LENGTH] = "";
> + int ret;
> +
> + ret = sysinfo_get_and_detect(&sysinfo);
> + if (ret) {
> + pr_err("Failed to get sysinfo data: %d\n", ret);
> + return;
> + }
The zero-initialisation of buf is dead, i.e. strlcpy() in the driver
always writes when sysinfo_get_str() returns 0, and env_set_runtime()
is skipped otherwise. And since the helper cannot signal failure to
the caller, please return int so board_late_init() in patch 7 can
propagate or log some context rather than relying on a bare pr_err().
Regards,
Simon
More information about the U-Boot
mailing list