* [PATCH] eal/unix: enhance error reporting for firmware
@ 2023-09-22 8:06 David Marchand
2023-09-27 9:19 ` David Marchand
0 siblings, 1 reply; 2+ messages in thread
From: David Marchand @ 2023-09-22 8:06 UTC (permalink / raw)
To: dev; +Cc: syalavarthi, jerinjacobk
Put more details if a libarchive context initialisation fails.
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
lib/eal/unix/eal_firmware.c | 37 ++++++++++++++++++++++++++++++-------
1 file changed, 30 insertions(+), 7 deletions(-)
diff --git a/lib/eal/unix/eal_firmware.c b/lib/eal/unix/eal_firmware.c
index d1616b0bd9..80aaadacf1 100644
--- a/lib/eal/unix/eal_firmware.c
+++ b/lib/eal/unix/eal_firmware.c
@@ -25,19 +25,42 @@ static int
firmware_open(struct firmware_read_ctx *ctx, const char *name, size_t blocksize)
{
struct archive_entry *e;
+ int err;
ctx->a = archive_read_new();
if (ctx->a == NULL)
return -1;
- if (archive_read_support_format_raw(ctx->a) != ARCHIVE_OK ||
- archive_read_support_filter_xz(ctx->a) != ARCHIVE_OK ||
- archive_read_open_filename(ctx->a, name, blocksize) != ARCHIVE_OK ||
- archive_read_next_header(ctx->a, &e) != ARCHIVE_OK) {
- archive_read_free(ctx->a);
- ctx->a = NULL;
- return -1;
+ err = archive_read_support_format_raw(ctx->a);
+ if (err != ARCHIVE_OK) {
+ RTE_LOG(ERR, EAL, "archive_read_support_format_raw() failed with %d: %s\n",
+ err, archive_error_string(ctx->a));
+ goto err;
+ }
+ err = archive_read_support_filter_xz(ctx->a);
+ if (err != ARCHIVE_OK) {
+ RTE_LOG(ERR, EAL, "archive_read_support_filter_xz() failed with %d: %s\n",
+ err, archive_error_string(ctx->a));
+ goto err;
+ }
+ err = archive_read_open_filename(ctx->a, name, blocksize);
+ if (err != ARCHIVE_OK) {
+ RTE_LOG(ERR, EAL, "archive_read_open_filename() failed with %d: %s\n",
+ err, archive_error_string(ctx->a));
+ goto err;
+ }
+ err = archive_read_next_header(ctx->a, &e);
+ if (err != ARCHIVE_OK) {
+ RTE_LOG(ERR, EAL, "archive_read_next_header() failed with %d: %s\n",
+ err, archive_error_string(ctx->a));
+ goto err;
}
+
return 0;
+
+err:
+ archive_read_free(ctx->a);
+ ctx->a = NULL;
+ return -1;
}
static ssize_t
--
2.41.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] eal/unix: enhance error reporting for firmware
2023-09-22 8:06 [PATCH] eal/unix: enhance error reporting for firmware David Marchand
@ 2023-09-27 9:19 ` David Marchand
0 siblings, 0 replies; 2+ messages in thread
From: David Marchand @ 2023-09-27 9:19 UTC (permalink / raw)
To: dev; +Cc: syalavarthi, jerinjacobk
On Fri, Sep 22, 2023 at 10:06 AM David Marchand
<david.marchand@redhat.com> wrote:
>
> Put more details if a libarchive context initialisation fails.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
Now that the original reported issue has been understood, I don't
think we need this patch.
I'll discard it in patchwork.
--
David Marchand
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-27 9:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-22 8:06 [PATCH] eal/unix: enhance error reporting for firmware David Marchand
2023-09-27 9:19 ` David Marchand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).