[libvirt PATCH v2 3/3] nodedev: remove unnecessary checks for NULL cmd

Jonathon Jongsma jjongsma at redhat.com
Wed Apr 21 15:52:36 UTC 2021


virCommandRun() already handles the case where the cmd argument is NULL,
so there's no need for the caller to check. Make all callers consistent
and remove unnecessary NULL checks.

Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
---
 src/node_device/node_device_driver.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index 49f3cc166d..8a0a2c3847 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -799,9 +799,6 @@ virMdevctlCreate(virNodeDeviceDef *def, char **uuid, char **errmsg)
                                                             MDEVCTL_CMD_CREATE,
                                                             uuid,
                                                             errmsg);
-    if (!cmd)
-        return -1;
-
     /* an auto-generated uuid is returned via stdout if no uuid is specified in
      * the mdevctl args */
     if (virCommandRun(cmd, &status) < 0 || status != 0)
@@ -822,9 +819,6 @@ virMdevctlDefine(virNodeDeviceDef *def, char **uuid, char **errmsg)
                                                             MDEVCTL_CMD_DEFINE,
                                                             uuid, errmsg);
 
-    if (!cmd)
-        return -1;
-
     /* an auto-generated uuid is returned via stdout if no uuid is specified in
      * the mdevctl args */
     if (virCommandRun(cmd, &status) < 0 || status != 0)
-- 
2.26.3




More information about the libvir-list mailing list