On 1/4/24 01:17, Artem Chernyshev wrote: > udevGetStringSysfsAttr() return value > is invariant, so change it type and remove all dependent > checks. > > Fixes: 7f1f0453fc ("node_device: use g_strdup instead of VIR_STRDUP") > > Signed-off-by: Artem Chernyshev <artem.chernyshev@xxxxxxxxxxx> > --- > src/node_device/node_device_udev.c | 55 +++++++++--------------------- > 1 file changed, 16 insertions(+), 39 deletions(-) > > diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c > index 8d38aec070..b610bc9c16 100644 > --- a/src/node_device/node_device_udev.c > +++ b/src/node_device/node_device_udev.c > @@ -245,7 +245,7 @@ udevGetDeviceSysfsAttr(struct udev_device *udev_device, > } > > > -static int > +static void > udevGetStringSysfsAttr(struct udev_device *udev_device, > const char *attr_name, > char **value) > @@ -256,8 +256,6 @@ udevGetStringSysfsAttr(struct udev_device *udev_device, > > if (*value != NULL && (STREQ(*value, ""))) > VIR_FREE(*value); > - > - return 0; > } > > > @@ -536,10 +534,9 @@ udevProcessUSBDevice(struct udev_device *device, > "ID_VENDOR_FROM_DATABASE", > &usb_dev->vendor_name); > > - if (!usb_dev->vendor_name && > + if (!usb_dev->vendor_name) > udevGetStringSysfsAttr(device, "manufacturer", > - &usb_dev->vendor_name) < 0) > - return -1; > + &usb_dev->vendor_name); > We can take this opportunity and write the code such that it follows our coding style: https://libvirt.org/coding-style.html#curly-braces Since the body is a multiline statement it has to be wrapped in curly braces. Michal _______________________________________________ Devel mailing list -- devel@xxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx