ptxed: fix load_raw() error values
On error, load_raw() returns 1, yet its caller checks for < 0 to detect errors.
Stick to that convention and adjust load_raw().
Change-Id: I17992fe01b205907d179766e3fa0e3c3b867eb7a
Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
diff --git a/ptxed/src/ptxed.c b/ptxed/src/ptxed.c
index b586458..a7f2607 100644
--- a/ptxed/src/ptxed.c
+++ b/ptxed/src/ptxed.c
@@ -411,13 +411,13 @@
has_base = extract_base(arg, &base);
if (has_base <= 0)
- return 1;
+ return -1;
errcode = preprocess_filename(arg, &foffset, &fsize);
if (errcode < 0) {
fprintf(stderr, "%s: bad file %s: %s.\n", prog, arg,
pt_errstr(pt_errcode(errcode)));
- return 1;
+ return -1;
}
if (!fsize)
@@ -427,14 +427,14 @@
if (isid < 0) {
fprintf(stderr, "%s: failed to add %s at 0x%" PRIx64 ": %s.\n",
prog, arg, base, pt_errstr(pt_errcode(isid)));
- return 1;
+ return -1;
}
errcode = pt_image_add_cached(image, iscache, isid, NULL);
if (errcode < 0) {
fprintf(stderr, "%s: failed to add %s at 0x%" PRIx64 ": %s.\n",
prog, arg, base, pt_errstr(pt_errcode(errcode)));
- return 1;
+ return -1;
}
return 0;