[libvirt PATCH 6/6] virDomainSEVDefParseXML: Remove superfluous variable initialization

Tim Wiederhake posted 6 patches 4 years, 7 months ago
[libvirt PATCH 6/6] virDomainSEVDefParseXML: Remove superfluous variable initialization
Posted by Tim Wiederhake 4 years, 7 months ago
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
---
 src/conf/domain_conf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index db8ec23d70..2d8ae7e860 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14721,7 +14721,7 @@ virDomainSEVDefParseXML(xmlNodePtr sevNode,
     VIR_XPATH_NODE_AUTORESTORE(ctxt)
     g_autoptr(virDomainSEVDef) def = NULL;
     unsigned long policy;
-    int rc = -1;
+    int rc;
 
     def = g_new0(virDomainSEVDef, 1);
 
-- 
2.31.1

Re: [libvirt PATCH 6/6] virDomainSEVDefParseXML: Remove superfluous variable initialization
Posted by Erik Skultety 4 years, 6 months ago
On Mon, Jul 05, 2021 at 12:46:54PM +0200, Tim Wiederhake wrote:
> Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
> ---
>  src/conf/domain_conf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index db8ec23d70..2d8ae7e860 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -14721,7 +14721,7 @@ virDomainSEVDefParseXML(xmlNodePtr sevNode,
>      VIR_XPATH_NODE_AUTORESTORE(ctxt)
>      g_autoptr(virDomainSEVDef) def = NULL;
>      unsigned long policy;
> -    int rc = -1;
> +    int rc;

This is just a pointless nitpick (given that this has already been pushed),
but initializing a variable at the time of its definition is actually a good
practice, so there was really no point in this patch, the only bad thing about
the code segment is that we're inconsistent.

Regards,
Erik