[PATCH] cmd: Flush destination buffer only if it is available

Tom Rini trini at konsulko.com
Mon May 19 16:19:05 CEST 2025


On Mon, May 19, 2025 at 12:19:34PM +0530, Varadarajan Narayanan wrote:

> From: Vandhiadevan Karunamoorthy <quic_vkarunam at quicinc.com>
> 
> There are code paths in do_imgextract(), where 'dest' could be zero.
> Hence, avoid cache flush of 'dest' doesn't point to any data buffer.
> 
> Signed-off-by: Vandhiadevan Karunamoorthy <quic_vkarunam at quicinc.com>
> Signed-off-by: Varadarajan Narayanan <quic_varada at quicinc.com>
> ---
>  cmd/ximg.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/cmd/ximg.c b/cmd/ximg.c
> index 29d7c3279b3..8907b579d4c 100644
> --- a/cmd/ximg.c
> +++ b/cmd/ximg.c
> @@ -265,7 +265,8 @@ do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
>  		puts("OK\n");
>  	}
>  
> -	flush_cache(dest, ALIGN(len, ARCH_DMA_MINALIGN));
> +	if (dest)
> +		flush_cache(dest, ALIGN(len, ARCH_DMA_MINALIGN));
>  
>  	env_set_hex("fileaddr", data);
>  	env_set_hex("filesize", len);
> 
> base-commit: 1b5e435102aa29a665119430196cb366ce36a01b

A memory base of 0x0 is valid and not that uncommon, is there more going
on here that lead to this patch?

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20250519/3b9f57b1/attachment.sig>


More information about the U-Boot mailing list