There is no need for a temporary variable in this function, and since it can't return NULL, no need for callers to check for it. Signed-off-by: Laine Stump <laine@xxxxxxxxxx> --- src/util/virpci.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/util/virpci.c b/src/util/virpci.c index 0786ddd478..ac37a60576 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -209,10 +209,7 @@ VIR_ONCE_GLOBAL_INIT(virPCI); static char * virPCIDriverDir(const char *driver) { - char *buffer; - - buffer = g_strdup_printf(PCI_SYSFS "drivers/%s", driver); - return buffer; + return g_strdup_printf(PCI_SYSFS "drivers/%s", driver); } @@ -1002,7 +999,9 @@ virPCIProbeStubDriver(virPCIStubDriver driver) } recheck: - if ((drvpath = virPCIDriverDir(drvname)) && virFileExists(drvpath)) + drvpath = virPCIDriverDir(drvname); + + if (virFileExists(drvpath)) /* driver already loaded, return */ return 0; @@ -1153,9 +1152,7 @@ virPCIDeviceBindToStub(virPCIDevicePtr dev) return -1; } - if (!(stubDriverPath = virPCIDriverDir(stubDriverName))) - return -1; - + stubDriverPath = virPCIDriverDir(stubDriverName); driverLink = virPCIFile(dev->name, "driver"); if (virFileExists(driverLink)) { -- 2.26.2