[PATCH] cosmetic: remove unused function return value

Ani Sinha posted 1 patch 2 years, 6 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20211024054043.357202-1-ani@anisinha.ca
src/qemu/qemu_command.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
[PATCH] cosmetic: remove unused function return value
Posted by Ani Sinha 2 years, 6 months ago
qemuBuildPMPCIRootHotplugCommandLine() returns 0 unconditionally. There is no
failure scenario at present. So clean up the code by removing integer return
from the function and also remove the failure check conditional from the
function call.
Also fix indentation for the above function call while at it.

Signed-off-by: Ani Sinha <ani@anisinha.ca>
---
 src/qemu/qemu_command.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d6df50ec73..093d8ae62c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3177,9 +3177,9 @@ qemuBuildSkipController(const virDomainControllerDef *controller,
     return false;
 }
 
-static int
+static void
 qemuBuildPMPCIRootHotplugCommandLine(virCommand *cmd,
-                              const virDomainControllerDef *controller)
+                                     const virDomainControllerDef *controller)
 {
     if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
         controller->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT &&
@@ -3189,7 +3189,7 @@ qemuBuildPMPCIRootHotplugCommandLine(virCommand *cmd,
             virCommandAddArgFormat(cmd, "PIIX4_PM.acpi-root-pci-hotplug=%s",
                                    virTristateSwitchTypeToString(controller->opts.pciopts.hotplug));
     }
-    return 0;
+    return;
 }
 
 static int
@@ -3207,8 +3207,7 @@ qemuBuildControllersByTypeCommandLine(virCommand *cmd,
         if (cont->type != type)
             continue;
 
-        if (qemuBuildPMPCIRootHotplugCommandLine(cmd, cont))
-            continue;
+        qemuBuildPMPCIRootHotplugCommandLine(cmd, cont);
 
         if (qemuBuildSkipController(cont, def))
             continue;
-- 
2.25.1

Re: [PATCH] cosmetic: remove unused function return value
Posted by Laine Stump 2 years, 6 months ago
On 10/24/21 1:40 AM, Ani Sinha wrote:
> qemuBuildPMPCIRootHotplugCommandLine() returns 0 unconditionally. There is no
> failure scenario at present. So clean up the code by removing integer return
> from the function and also remove the failure check conditional from the
> function call.
> Also fix indentation for the above function call while at it.
> 
> Signed-off-by: Ani Sinha <ani@anisinha.ca>

Reviewed-by: Laine Stump <laine@redhat.com>

and pushed.

> ---
>   src/qemu/qemu_command.c | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index d6df50ec73..093d8ae62c 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -3177,9 +3177,9 @@ qemuBuildSkipController(const virDomainControllerDef *controller,
>       return false;
>   }
>   
> -static int
> +static void
>   qemuBuildPMPCIRootHotplugCommandLine(virCommand *cmd,
> -                              const virDomainControllerDef *controller)
> +                                     const virDomainControllerDef *controller)
>   {
>       if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
>           controller->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT &&
> @@ -3189,7 +3189,7 @@ qemuBuildPMPCIRootHotplugCommandLine(virCommand *cmd,
>               virCommandAddArgFormat(cmd, "PIIX4_PM.acpi-root-pci-hotplug=%s",
>                                      virTristateSwitchTypeToString(controller->opts.pciopts.hotplug));
>       }
> -    return 0;
> +    return;
>   }
>   
>   static int
> @@ -3207,8 +3207,7 @@ qemuBuildControllersByTypeCommandLine(virCommand *cmd,
>           if (cont->type != type)
>               continue;
>   
> -        if (qemuBuildPMPCIRootHotplugCommandLine(cmd, cont))
> -            continue;
> +        qemuBuildPMPCIRootHotplugCommandLine(cmd, cont);
>   
>           if (qemuBuildSkipController(cont, def))
>               continue;
>