mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
util: simplify virPCIDriverDir() and its callers
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@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
862f7e5c73
commit
b3066b55bf
@ -209,10 +209,7 @@ VIR_ONCE_GLOBAL_INIT(virPCI);
|
|||||||
static char *
|
static char *
|
||||||
virPCIDriverDir(const char *driver)
|
virPCIDriverDir(const char *driver)
|
||||||
{
|
{
|
||||||
char *buffer;
|
return g_strdup_printf(PCI_SYSFS "drivers/%s", driver);
|
||||||
|
|
||||||
buffer = g_strdup_printf(PCI_SYSFS "drivers/%s", driver);
|
|
||||||
return buffer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1002,7 +999,9 @@ virPCIProbeStubDriver(virPCIStubDriver driver)
|
|||||||
}
|
}
|
||||||
|
|
||||||
recheck:
|
recheck:
|
||||||
if ((drvpath = virPCIDriverDir(drvname)) && virFileExists(drvpath))
|
drvpath = virPCIDriverDir(drvname);
|
||||||
|
|
||||||
|
if (virFileExists(drvpath))
|
||||||
/* driver already loaded, return */
|
/* driver already loaded, return */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -1153,9 +1152,7 @@ virPCIDeviceBindToStub(virPCIDevicePtr dev)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(stubDriverPath = virPCIDriverDir(stubDriverName)))
|
stubDriverPath = virPCIDriverDir(stubDriverName);
|
||||||
return -1;
|
|
||||||
|
|
||||||
driverLink = virPCIFile(dev->name, "driver");
|
driverLink = virPCIFile(dev->name, "driver");
|
||||||
|
|
||||||
if (virFileExists(driverLink)) {
|
if (virFileExists(driverLink)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user