QEMU-Devel Archive mirror
 help / color / mirror / Atom feed
From: Peng Liang <liangpeng10@huawei.com>
To: <qemu-devel@nongnu.org>
Cc: philmd@redhat.com, alejandro.j.jimenez@oracle.com,
	laurent@vivier.eu, xiexiangyou@huawei.com, armbru@redhat.com,
	liangpeng10@huawei.com, pbonzini@redhat.com,
	alex.bennee@linaro.org
Subject: [PATCH] runstate: Initialize Error * to NULL
Date: Thu, 10 Jun 2021 21:17:29 +0800	[thread overview]
Message-ID: <20210610131729.3906565-1-liangpeng10@huawei.com> (raw)

Based on the description of error_setg(), the local variable err in
qemu_init_subsystems() should be initialized to NULL.

Fix: efd7ab22fb "vl: extract qemu_init_subsystems"
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
---
The patch is generated by the following coccinelle script (thanks to
Markus):
@ r @
identifier id;
@@
(
  static Error *id;
|
  Error *id
+ = NULL
  ;
)
And exclude the modifications in softmmu/vl.c (which has fixed by
Zhenzhong Duan already) and util/error.c (which are unnecessary).

 softmmu/runstate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/softmmu/runstate.c b/softmmu/runstate.c
index ce8977c6a29c..54713100c2ea 100644
--- a/softmmu/runstate.c
+++ b/softmmu/runstate.c
@@ -746,7 +746,7 @@ static void qemu_run_exit_notifiers(void)
 
 void qemu_init_subsystems(void)
 {
-    Error *err;
+    Error *err = NULL;
 
     os_set_line_buffering();
 
-- 
2.31.1



             reply	other threads:[~2021-06-10 13:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10 13:17 Peng Liang [this message]
2021-06-10 13:25 ` [PATCH] runstate: Initialize Error * to NULL Daniel P. Berrangé
2021-06-10 13:41 ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210610131729.3906565-1-liangpeng10@huawei.com \
    --to=liangpeng10@huawei.com \
    --cc=alejandro.j.jimenez@oracle.com \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xiexiangyou@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).