All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v7 1/2] libxc: Report consistent errors in xc_resource_op
@ 2026-02-23 16:06 Teddy Astie
  2026-02-23 16:06 ` [PATCH v7 2/2] xenpm: Add get-dts-temp subcommand Teddy Astie
  2026-02-23 16:13 ` [PATCH v7 1/2] libxc: Report consistent errors in xc_resource_op Jan Beulich
  0 siblings, 2 replies; 7+ messages in thread
From: Teddy Astie @ 2026-02-23 16:06 UTC (permalink / raw)
  To: xen-devel; +Cc: Teddy Astie, Anthony PERARD, Juergen Gross

xc_report_op returns -1 in some error conditions.
Make sure it returns -ENOMEM in out of memory errors and -EINVAL
in invalid usages errors.

Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
---
v7: Introduced

 tools/libs/ctrl/xc_resource.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/libs/ctrl/xc_resource.c b/tools/libs/ctrl/xc_resource.c
index cb6a97202b..1ca71ee048 100644
--- a/tools/libs/ctrl/xc_resource.c
+++ b/tools/libs/ctrl/xc_resource.c
@@ -28,7 +28,7 @@ static int xc_resource_op_one(xc_interface *xch, xc_resource_op_t *op)
                                 XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
 
     if ( xc_hypercall_bounce_pre(xch, entries) )
-        return -1;
+        return -ENOMEM;
 
     platform_op.cmd = XENPF_resource_op;
     platform_op.u.resource_op.nr_entries = op->nr_entries;
@@ -54,19 +54,19 @@ static int xc_resource_op_multi(xc_interface *xch, uint32_t nr_ops, xc_resource_
     call_list = xc_hypercall_buffer_alloc(xch, call_list,
                                           sizeof(*call_list) * nr_ops);
     if ( !call_list )
-        return -1;
+        return -ENOMEM;
 
     platform_ops = xc_hypercall_buffer_array_create(xch, nr_ops);
     if ( !platform_ops )
     {
-        rc = -1;
+        rc = -ENOMEM;
         goto out;
     }
 
     entries_list = xc_hypercall_buffer_array_create(xch, nr_ops);
     if ( !entries_list )
     {
-        rc = -1;
+        rc = -ENOMEM;
         goto out;
     }
 
@@ -81,7 +81,7 @@ static int xc_resource_op_multi(xc_interface *xch, uint32_t nr_ops, xc_resource_
                         platform_op, sizeof(xen_platform_op_t));
         if ( !platform_op )
         {
-            rc = -1;
+            rc = -ENOMEM;
             goto out;
         }
 
@@ -90,7 +90,7 @@ static int xc_resource_op_multi(xc_interface *xch, uint32_t nr_ops, xc_resource_
                    entries, entries_size);
         if ( !entries)
         {
-            rc = -1;
+            rc = -ENOMEM;
             goto out;
         }
         memcpy(entries, op->entries, entries_size);
@@ -137,7 +137,7 @@ int xc_resource_op(xc_interface *xch, uint32_t nr_ops, xc_resource_op_t *ops)
     if ( nr_ops > 1 )
         return xc_resource_op_multi(xch, nr_ops, ops);
 
-    return -1;
+    return -EINVAL;
 }
 
 /*
-- 
2.53.0



--
Teddy Astie | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-02-25 10:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-23 16:06 [PATCH v7 1/2] libxc: Report consistent errors in xc_resource_op Teddy Astie
2026-02-23 16:06 ` [PATCH v7 2/2] xenpm: Add get-dts-temp subcommand Teddy Astie
2026-02-23 16:28   ` Jan Beulich
2026-02-23 16:13 ` [PATCH v7 1/2] libxc: Report consistent errors in xc_resource_op Jan Beulich
2026-02-24  9:28   ` Teddy Astie
2026-02-24  9:36     ` Jan Beulich
2026-02-25 10:50     ` Anthony PERARD

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.