[12/15] libxl_usb: Fix libxl_device_usbctrl_getinfo
diff mbox series

Message ID 20190614112444.29980-13-anthony.perard@citrix.com
State New, archived
Headers show
Series
  • Some cleanup of libxl
Related show

Commit Message

Anthony PERARD June 14, 2019, 11:24 a.m. UTC
`usbctrl' is modified in this function which doesn't seems to be
intended, and usbctrlinfo.backend_id was never modified.

Take this opportunity to consify the argument `usbctrl' in libxl API
to avoid similar mistake.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libxl/libxl.h     | 2 +-
 tools/libxl/libxl_usb.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Ian Jackson Sept. 17, 2019, 4:44 p.m. UTC | #1
Anthony PERARD writes ("[PATCH 12/15] libxl_usb: Fix libxl_device_usbctrl_getinfo"):
> `usbctrl' is modified in this function which doesn't seems to be
> intended, and usbctrlinfo.backend_id was never modified.
> 
> Take this opportunity to consify the argument `usbctrl' in libxl API
> to avoid similar mistake.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

Patch
diff mbox series

diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 9bacfb97f0..750ef1b7d0 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -1950,7 +1950,7 @@  void libxl_device_usbctrl_list_free(libxl_device_usbctrl *list, int nr);
 
 
 int libxl_device_usbctrl_getinfo(libxl_ctx *ctx, uint32_t domid,
-                                 libxl_device_usbctrl *usbctrl,
+                                 const libxl_device_usbctrl *usbctrl,
                                  libxl_usbctrlinfo *usbctrlinfo);
 
 /* USB Devices */
diff --git a/tools/libxl/libxl_usb.c b/tools/libxl/libxl_usb.c
index 694870a3c3..9851fe8468 100644
--- a/tools/libxl/libxl_usb.c
+++ b/tools/libxl/libxl_usb.c
@@ -641,7 +641,7 @@  libxl_device_usbctrl_list(libxl_ctx *ctx, uint32_t domid, int *num)
 }
 
 int libxl_device_usbctrl_getinfo(libxl_ctx *ctx, uint32_t domid,
-                                 libxl_device_usbctrl *usbctrl,
+                                 const libxl_device_usbctrl *usbctrl,
                                  libxl_usbctrlinfo *usbctrlinfo)
 {
     GC_INIT(ctx);
@@ -678,7 +678,7 @@  int libxl_device_usbctrl_getinfo(libxl_ctx *ctx, uint32_t domid,
         be_path = READ_SUBPATH(libxl_path, "backend");
         usbctrlinfo->backend = libxl__strdup(NOGC, be_path);
         rc = libxl__backendpath_parse_domid(gc, be_path,
-                                            &usbctrl->backend_domid);
+                                            &usbctrlinfo->backend_id);
         if (rc) goto out;
         usbctrlinfo->state = READ_SUBPATH_INT(fe_path, "state");
         usbctrlinfo->evtch = READ_SUBPATH_INT(fe_path, "event-channel");
@@ -691,7 +691,7 @@  int libxl_device_usbctrl_getinfo(libxl_ctx *ctx, uint32_t domid,
     } else {
         usbctrlinfo->ports = READ_SUBPATH_INT(libxl_path, "num-ports");
         usbctrlinfo->version = READ_SUBPATH_INT(libxl_path, "usb-ver");
-        rc = libxl__get_domid(gc, &usbctrl->backend_domid);
+        rc = libxl__get_domid(gc, &usbctrlinfo->backend_id);
         if (rc) goto out;
     }