diff mbox series

runstate: Initialize Error * to NULL

Message ID 20210610131729.3906565-1-liangpeng10@huawei.com (mailing list archive)
State New, archived
Headers show
Series runstate: Initialize Error * to NULL | expand

Commit Message

Peng Liang June 10, 2021, 1:17 p.m. UTC
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(-)

Comments

Daniel P. Berrangé June 10, 2021, 1:25 p.m. UTC | #1
On Thu, Jun 10, 2021 at 09:17:29PM +0800, Peng Liang wrote:
> 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(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
Paolo Bonzini June 10, 2021, 1:41 p.m. UTC | #2
On 10/06/21 15:17, Peng Liang wrote:
> 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();
>   
> 

Queued, thanks.

Cc: qemu-stable@nongnu.org

Paolo
diff mbox series

Patch

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();