From dddb8069d021da76c6af86acfd9244bdb14a9a2f Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Fri, 16 Aug 2019 17:01:18 -0500 Subject: [PATCH] st/prober: Minor clang-tidy fixes. --- src/xrt/state_trackers/prober/p_prober.c | 5 ++--- src/xrt/state_trackers/prober/p_udev.c | 19 +++++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/xrt/state_trackers/prober/p_prober.c b/src/xrt/state_trackers/prober/p_prober.c index 4473fcf22..007398ee9 100644 --- a/src/xrt/state_trackers/prober/p_prober.c +++ b/src/xrt/state_trackers/prober/p_prober.c @@ -75,7 +75,7 @@ destroy(struct xrt_prober** xp); */ int -xrt_prober_create_with_lists(struct xrt_prober** out_xp, +xrt_prober_create_with_lists(struct xrt_prober** out_prober, struct xrt_prober_entry_lists* lists) { struct prober* p = U_TYPED_CALLOC(struct prober); @@ -86,7 +86,7 @@ xrt_prober_create_with_lists(struct xrt_prober** out_xp, return ret; } - *out_xp = &p->base; + *out_prober = &p->base; return 0; } @@ -439,7 +439,6 @@ handle_found_device(struct prober* p, P_ERROR(p, "Found more then one, HMD closing '%s'", xdev->name); xdev->destroy(xdev); - return; } static int diff --git a/src/xrt/state_trackers/prober/p_udev.c b/src/xrt/state_trackers/prober/p_udev.c index 587ba96bb..436fc7538 100644 --- a/src/xrt/state_trackers/prober/p_udev.c +++ b/src/xrt/state_trackers/prober/p_udev.c @@ -106,12 +106,12 @@ p_udev_get_usb_device_address_sysfs(struct udev_device* usb_dev, static int p_udev_get_sysattr_u16_base16(struct udev_device* dev, - const char* str, + const char* name, uint16_t* out_value); static int p_udev_get_sysattr_u32_base10(struct udev_device* dev, - const char* str, + const char* name, uint32_t* out_value); XRT_MAYBE_UNUSED static void @@ -139,7 +139,7 @@ p_udev_probe(struct prober* p) p_udev_enumerate_hidraw(p, udev); - udev = udev_unref(udev); + udev_unref(udev); return 0; } @@ -220,7 +220,7 @@ p_udev_enumerate_usb(struct prober* p, struct udev* udev) udev_device_unref(raw_dev); } - enumerate = udev_enumerate_unref(enumerate); + udev_enumerate_unref(enumerate); } static void @@ -321,7 +321,7 @@ p_udev_enumerate_v4l2(struct prober* p, struct udev* udev) udev_device_unref(raw_dev); } - enumerate = udev_enumerate_unref(enumerate); + udev_enumerate_unref(enumerate); } static void @@ -439,7 +439,7 @@ p_udev_enumerate_hidraw(struct prober* p, struct udev* udev) udev_device_unref(raw_dev); } - enumerate = udev_enumerate_unref(enumerate); + udev_enumerate_unref(enumerate); } static void @@ -449,7 +449,7 @@ p_udev_add_hidraw(struct prober_device* pdev, { size_t new_size = (pdev->num_hidraws + 1) * sizeof(struct prober_hidraw); - pdev->hidraws = realloc(pdev->hidraws, new_size); + pdev->hidraws = (struct prober_hidraw*)realloc(pdev->hidraws, new_size); struct prober_hidraw* hidraw = &pdev->hidraws[pdev->num_hidraws++]; U_ZERO(hidraw); @@ -565,7 +565,7 @@ p_udev_get_and_parse_uevent(struct udev_device* raw_dev, union { uint8_t arr[8]; uint64_t v; - } extract = {0}; + } extract = {{0}}; ret = sscanf(serial_utf8, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &extract.arr[5], &extract.arr[4], &extract.arr[3], @@ -583,9 +583,8 @@ p_udev_get_and_parse_uevent(struct udev_device* raw_dev, *out_product_id = product_id; *out_bluetooth_serial = bluetooth_serial; return 0; - } else { - return -1; } + return -1; } static int