Let's use a different variable for storing retvals of helper
functions. This way the usual function pattern can be restored.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/node_device/node_device_udev.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index f48789d98f..3c31e6cde4 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -927,6 +927,7 @@ udevProcessStorage(struct udev_device *device,
{
virNodeDevCapStorage *storage = &def->caps->data.storage;
int ret = -1;
+ int rv;
const char* devnode;
devnode = udev_device_get_devnode(device);
@@ -971,22 +972,26 @@ udevProcessStorage(struct udev_device *device,
}
if (STREQ(def->caps->data.storage.drive_type, "cd")) {
- ret = udevProcessCDROM(device, def);
+ rv = udevProcessCDROM(device, def);
} else if (STREQ(def->caps->data.storage.drive_type, "disk")) {
- ret = udevProcessDisk(device, def);
+ rv = udevProcessDisk(device, def);
} else if (STREQ(def->caps->data.storage.drive_type, "floppy")) {
- ret = udevProcessFloppy(device, def);
+ rv = udevProcessFloppy(device, def);
} else if (STREQ(def->caps->data.storage.drive_type, "sd")) {
- ret = udevProcessSD(device, def);
+ rv = udevProcessSD(device, def);
} else if (STREQ(def->caps->data.storage.drive_type, "dasd")) {
- ret = udevProcessDASD(device, def);
+ rv = udevProcessDASD(device, def);
} else {
VIR_DEBUG("Unsupported storage type '%s'",
def->caps->data.storage.drive_type);
goto cleanup;
}
+ if (rv < 0)
+ goto cleanup;
+
udevGenerateDeviceName(device, def, storage->serial);
+ ret = 0;
cleanup:
VIR_DEBUG("Storage ret=%d", ret);
--
2.31.1