diff mbox

[RFC,1/5] serial-pci: Avoid qerror_report_err() outside QMP command handlers

Message ID 1425114327-12136-2-git-send-email-zhang.zhanghailiang@huawei.com
State New
Headers show

Commit Message

Zhanghailiang Feb. 28, 2015, 9:05 a.m. UTC
qerror_report_err() is a transitional interface to help with
converting existing monitor commands to QMP.  It should not be used
elsewhere.  Replace by error_report_err() in serial_pci_init() and
multi_serial_pci_init().

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
---
 hw/char/serial-pci.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Markus Armbruster March 2, 2015, 10:02 a.m. UTC | #1
zhanghailiang <zhang.zhanghailiang@huawei.com> writes:

> qerror_report_err() is a transitional interface to help with
> converting existing monitor commands to QMP.  It should not be used
> elsewhere.  Replace by error_report_err() in serial_pci_init() and
> multi_serial_pci_init().
>
> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
> ---
>  hw/char/serial-pci.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c
> index f05c9b4..2b0bf54 100644
> --- a/hw/char/serial-pci.c
> +++ b/hw/char/serial-pci.c
> @@ -27,7 +27,6 @@
>  
>  #include "hw/char/serial.h"
>  #include "hw/pci/pci.h"
> -#include "qapi/qmp/qerror.h"
>  
>  #define PCI_SERIAL_MAX_PORTS 4
>  
> @@ -57,8 +56,7 @@ static int serial_pci_init(PCIDevice *dev)
>      s->baudbase = 115200;
>      serial_realize_core(s, &err);
>      if (err != NULL) {
> -        qerror_report_err(err);
> -        error_free(err);
> +        error_report_err(err);
>          return -1;
>      }
>  
> @@ -116,8 +114,7 @@ static int multi_serial_pci_init(PCIDevice *dev)
>          s->baudbase = 115200;
>          serial_realize_core(s, &err);
>          if (err != NULL) {
> -            qerror_report_err(err);
> -            error_free(err);
> +            error_report_err(err);
>              return -1;
>          }
>          s->irq = pci->irqs[i];

This breaks the error reply when you hot plug the devices via QMP
device_add.

The correct solution is my "[PATCH 06/10] serial-pci: Convert to
realize".
diff mbox

Patch

diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c
index f05c9b4..2b0bf54 100644
--- a/hw/char/serial-pci.c
+++ b/hw/char/serial-pci.c
@@ -27,7 +27,6 @@ 
 
 #include "hw/char/serial.h"
 #include "hw/pci/pci.h"
-#include "qapi/qmp/qerror.h"
 
 #define PCI_SERIAL_MAX_PORTS 4
 
@@ -57,8 +56,7 @@  static int serial_pci_init(PCIDevice *dev)
     s->baudbase = 115200;
     serial_realize_core(s, &err);
     if (err != NULL) {
-        qerror_report_err(err);
-        error_free(err);
+        error_report_err(err);
         return -1;
     }
 
@@ -116,8 +114,7 @@  static int multi_serial_pci_init(PCIDevice *dev)
         s->baudbase = 115200;
         serial_realize_core(s, &err);
         if (err != NULL) {
-            qerror_report_err(err);
-            error_free(err);
+            error_report_err(err);
             return -1;
         }
         s->irq = pci->irqs[i];