]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
nodedev: remove unnecessary checks for NULL cmd
authorJonathon Jongsma <jjongsma@redhat.com>
Wed, 21 Apr 2021 15:47:43 +0000 (10:47 -0500)
committerJonathon Jongsma <jjongsma@redhat.com>
Mon, 26 Apr 2021 17:24:22 +0000 (12:24 -0500)
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@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/node_device/node_device_driver.c

index 49f3cc166d8eb433015c10f4ca94337ab2fdd8a0..8a0a2c3847caa486ab061e43c5cc1ca771f5fdd4 100644 (file)
@@ -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)