From 07202bf4cf955f1cc582daf482a38cbf3d86d4d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Fri, 3 Jun 2016 14:49:21 +0200 Subject: [PATCH] Remove udevStrToLong_ui MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the debug message, open code the error in the two udevGetUint callers and use a more specific error in SCSI and PCI processing. --- src/node_device/node_device_udev.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index ff9668ce53..5b341d98b5 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -58,23 +58,6 @@ struct _udevPrivate { }; -static int udevStrToLong_ui(char const *s, - char **end_ptr, - int base, - unsigned int *result) -{ - int ret = 0; - - ret = virStrToLong_ui(s, end_ptr, base, result); - if (ret != 0) { - VIR_ERROR(_("Failed to convert '%s' to unsigned int"), s); - } else { - VIR_DEBUG("Converted '%s' to unsigned int %u", s, *result); - } - - return ret; -} - static int udevStrToLong_i(char const *s, char **end_ptr, int base, @@ -165,8 +148,10 @@ static int udevGetUintProperty(struct udev_device *udev_device, ret = udevGetDeviceProperty(udev_device, property_key, &udev_value); if (ret == PROPERTY_FOUND) { - if (udevStrToLong_ui(udev_value, NULL, base, value) != 0) + if (virStrToLong_ui(udev_value, NULL, base, value) < 0) { + VIR_ERROR(_("Failed to convert '%s' to unsigned int"), udev_value); ret = PROPERTY_ERROR; + } } VIR_FREE(udev_value); @@ -264,8 +249,10 @@ static int udevGetUintSysfsAttr(struct udev_device *udev_device, ret = udevGetDeviceSysfsAttr(udev_device, attr_name, &udev_value); if (ret == PROPERTY_FOUND) { - if (udevStrToLong_ui(udev_value, NULL, base, value) != 0) + if (virStrToLong_ui(udev_value, NULL, base, value) < 0) { + VIR_ERROR(_("Failed to convert '%s' to unsigned int"), udev_value); ret = PROPERTY_ERROR; + } } VIR_FREE(udev_value); -- GitLab