[PATCH 1/4] dfu: do not overwrite "dfu_alt_info"

Jon Humphreys j-humphreys at ti.com
Tue Dec 17 21:55:13 CET 2024


Siddharth Vadapalli <s-vadapalli at ti.com> writes:

> From: Jonathan Humphreys <j-humphreys at ti.com>
>
> For use-cases such as USB DFU Boot, "spl_dfu_cmd()" will setup the
> appropriate value for "dfu_alt_info". To facilitate such use-cases and
> in order to avoid overwriting the value of "dfu_alt_info", invoke the
> "set_dfu_alt_info()" function only when "dfu_alt_info" is not defined.
>
> Signed-off-by: Jonathan Humphreys <j-humphreys at ti.com>
> Signed-off-by: Siddharth Vadapalli <s-vadapalli at ti.com>
> ---
>  drivers/dfu/dfu.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
> index 756569217bb..ab8abae1d89 100644
> --- a/drivers/dfu/dfu.c
> +++ b/drivers/dfu/dfu.c
> @@ -169,10 +169,13 @@ int dfu_init_env_entities(char *interface, char *devstr)
>  	dfu_reinit_needed = false;
>  	dfu_alt_info_changed = false;
>  
> +	str_env = env_get("dfu_alt_info");
>  #ifdef CONFIG_SET_DFU_ALT_INFO
> -	set_dfu_alt_info(interface, devstr);
> +	if (!str_env) {
> +		set_dfu_alt_info(interface, devstr);
> +		str_env = env_get("dfu_alt_info");
> +	}
>  #endif
> -	str_env = env_get("dfu_alt_info");
>  	if (!str_env) {
>  		pr_err("\"dfu_alt_info\" env variable not defined!\n");
>  		return -EINVAL;
> -- 
> 2.43.0

Hi Siddharth, thanks. I went ahead and just posted a separate patch to fix
this issue. I added a bit more explanation, and wanted it separate so that
it can hopefully make the 2025.01 release.

See https://lore.kernel.org/r/20241217204835.3312765-1-j-humphreys@ti.com.

Thanks
Jon


More information about the U-Boot mailing list