Re: [libvirt PATCH 1/2] src: remove redundant arg to virKModLoad

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/18/20 5:42 PM, Daniel P. Berrangé wrote:
All callers except for the test suite pass the same value
for the second arg, so it can be removed, simplifying the
code.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
  src/util/virfile.c  |  2 +-
  src/util/virkmod.c  |  8 +++-----
  src/util/virkmod.h  |  2 +-
  src/util/virpci.c   |  2 +-
  tests/virkmodtest.c | 44 +++++++++++---------------------------------
  5 files changed, 17 insertions(+), 41 deletions(-)

diff --git a/src/util/virfile.c b/src/util/virfile.c
index 20260a2e58..7b92c8767c 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -905,7 +905,7 @@ virFileNBDLoadDriver(void)
      } else {
          g_autofree char *errbuf = NULL;
- if ((errbuf = virKModLoad(NBD_DRIVER, true))) {
+        if ((errbuf = virKModLoad(NBD_DRIVER))) {
              virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                             _("Failed to load nbd module"));
              return false;
diff --git a/src/util/virkmod.c b/src/util/virkmod.c
index 12cb5920e8..59cec69816 100644
--- a/src/util/virkmod.c
+++ b/src/util/virkmod.c
@@ -31,8 +31,7 @@ doModprobe(const char *opts, const char *module, char **outbuf, char **errbuf)
      g_autoptr(virCommand) cmd = NULL;
cmd = virCommandNew(MODPROBE);
-    if (opts)
-        virCommandAddArg(cmd, opts);
+    virCommandAddArg(cmd, opts);

Or:

-    cmd = virCommandNew(MODPROBE);
-    virCommandAddArg(cmd, opts);
+    cmd = virCommandNewArgList(MODPROBE, opts, NULL);


Michal




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux