diff options
| author | Aristo Chen <[email protected]> | 2025-04-30 10:23:25 +0800 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-05-05 14:16:57 -0600 |
| commit | f717d798becf2dffd5816484962c350808e98a18 (patch) | |
| tree | 0f12139562f07d875e0e78f23015dcb696543629 /lib | |
| parent | 03f5101ff50d1b449c65a4483c725b4ae0446c62 (diff) | |
bootm: improve error message when gzip decompression buffer is too small
Currently, when decompressing a gzip-compressed image during bootm, a
generic error such as "inflate() returned -5" is shown when the buffer is
too small. However, it is not immediately clear that this is caused by
CONFIG_SYS_BOOTM_LEN being too small.
This patch improves error handling by:
- Detecting Z_BUF_ERROR (-5) returned from the inflate() call
- Suggesting the user to increase CONFIG_SYS_BOOTM_LEN when applicable
- Preserving the original return code from zunzip() instead of overwriting
it with -1
By providing clearer hints when decompression fails due to insufficient
buffer size, this change helps users diagnose and fix boot failures more
easily.
Signed-off-by: Aristo Chen <[email protected]>
Reviewed-by: Tom Rini <[email protected]>
Reviewed-by: Mattijs Korpershoek <[email protected]>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/gunzip.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/gunzip.c b/lib/gunzip.c index 52007715bda..a05dcde9a75 100644 --- a/lib/gunzip.c +++ b/lib/gunzip.c @@ -299,7 +299,7 @@ __rcode int zunzip(void *dst, int dstlen, unsigned char *src, if (stoponerr == 1 && r != Z_STREAM_END && (s.avail_in == 0 || s.avail_out == 0 || r != Z_BUF_ERROR)) { printf("Error: inflate() returned %d\n", r); - err = -1; + err = r; break; } } while (r == Z_BUF_ERROR); |
