diff mbox series

[13/14] ppc/xive: Simplify error handling in xive_tctx_realize()

Message ID 159707852234.1489912.16410314514265848075.stgit@bahia.lan (mailing list archive)
State New, archived
Headers show
Series ppc/spapr: Error handling fixes and cleanups | expand

Commit Message

Greg Kurz Aug. 10, 2020, 4:55 p.m. UTC
Now that kvmppc_xive_cpu_connect() returns a negative errno on failure,
use that and get rid of the local_err boilerplate.

Signed-off-by: Greg Kurz <groug@kaod.org>
---
 hw/intc/xive.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

David Gibson Aug. 13, 2020, 11:07 a.m. UTC | #1
On Mon, Aug 10, 2020 at 06:55:22PM +0200, Greg Kurz wrote:
> Now that kvmppc_xive_cpu_connect() returns a negative errno on failure,
> use that and get rid of the local_err boilerplate.
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>

Applied to ppc-for-5.2

> ---
>  hw/intc/xive.c |    5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/hw/intc/xive.c b/hw/intc/xive.c
> index 17ca5a1916b4..489e6256ef70 100644
> --- a/hw/intc/xive.c
> +++ b/hw/intc/xive.c
> @@ -662,7 +662,6 @@ static void xive_tctx_realize(DeviceState *dev, Error **errp)
>      XiveTCTX *tctx = XIVE_TCTX(dev);
>      PowerPCCPU *cpu;
>      CPUPPCState *env;
> -    Error *local_err = NULL;
>  
>      assert(tctx->cs);
>      assert(tctx->xptr);
> @@ -683,9 +682,7 @@ static void xive_tctx_realize(DeviceState *dev, Error **errp)
>  
>      /* Connect the presenter to the VCPU (required for CPU hotplug) */
>      if (xive_in_kernel(tctx->xptr)) {
> -        kvmppc_xive_cpu_connect(tctx, &local_err);
> -        if (local_err) {
> -            error_propagate(errp, local_err);
> +        if (kvmppc_xive_cpu_connect(tctx, errp) < 0) {
>              return;
>          }
>      }
> 
>
diff mbox series

Patch

diff --git a/hw/intc/xive.c b/hw/intc/xive.c
index 17ca5a1916b4..489e6256ef70 100644
--- a/hw/intc/xive.c
+++ b/hw/intc/xive.c
@@ -662,7 +662,6 @@  static void xive_tctx_realize(DeviceState *dev, Error **errp)
     XiveTCTX *tctx = XIVE_TCTX(dev);
     PowerPCCPU *cpu;
     CPUPPCState *env;
-    Error *local_err = NULL;
 
     assert(tctx->cs);
     assert(tctx->xptr);
@@ -683,9 +682,7 @@  static void xive_tctx_realize(DeviceState *dev, Error **errp)
 
     /* Connect the presenter to the VCPU (required for CPU hotplug) */
     if (xive_in_kernel(tctx->xptr)) {
-        kvmppc_xive_cpu_connect(tctx, &local_err);
-        if (local_err) {
-            error_propagate(errp, local_err);
+        if (kvmppc_xive_cpu_connect(tctx, errp) < 0) {
             return;
         }
     }