mbox series

[00/15] spapr: Error handling fixes and cleanups (round 2)

Message ID 20200914123505.612812-1-groug@kaod.org (mailing list archive)
Headers show
Series spapr: Error handling fixes and cleanups (round 2) | expand

Message

Greg Kurz Sept. 14, 2020, 12:34 p.m. UTC
Yet another round of sanitizing the error handling in spapr. I've
identified locations that needed fixing with the errp-guard.cocci
coccinelle script. It turns out that a better result is achieved
by fixing manually, especially by converting some void functions
to indicate success/failure with a return value.

Greg Kurz (15):
  spapr: Fix error leak in spapr_realize_vcpu()
  ppc: Add a return value to ppc_set_compat() and ppc_set_compat_all()
  ppc: Fix return value in cpu_post_load() error path
  spapr: Simplify error handling in callers of ppc_set_compat()
  spapr: Get rid of cas_check_pvr() error reporting
  spapr: Simplify error handling in do_client_architecture_support()
  spapr: Simplify error handling in spapr_vio_busdev_realize()
  spapr: Add a return value to spapr_drc_attach()
  spapr: Simplify error handling in prop_get_fdt()
  spapr: Add a return value to spapr_set_vcpu_id()
  spapr: Simplify error handling in spapr_cpu_core_realize()
  spapr: Add a return value to spapr_nvdimm_validate()
  spapr: Add a return value to spapr_check_pagesize()
  spapr: Simplify error handling in spapr_memory_plug()
  spapr: Simplify error handling in spapr_memory_unplug_request()

 include/hw/ppc/spapr.h        |  4 +-
 include/hw/ppc/spapr_drc.h    |  2 +-
 include/hw/ppc/spapr_nvdimm.h |  4 +-
 target/ppc/cpu.h              |  4 +-
 hw/ppc/spapr.c                | 76 ++++++++++++-----------------------
 hw/ppc/spapr_caps.c           |  7 +++-
 hw/ppc/spapr_cpu_core.c       | 24 +++++------
 hw/ppc/spapr_drc.c            | 17 ++++----
 hw/ppc/spapr_hcall.c          | 34 +++++++---------
 hw/ppc/spapr_nvdimm.c         | 24 +++++------
 hw/ppc/spapr_pci.c            |  5 +--
 hw/ppc/spapr_vio.c            | 12 +++---
 target/ppc/compat.c           | 26 +++++++-----
 target/ppc/machine.c          |  9 +++--
 14 files changed, 108 insertions(+), 140 deletions(-)

Comments

David Gibson Sept. 16, 2020, 2:49 a.m. UTC | #1
On Mon, Sep 14, 2020 at 02:34:50PM +0200, Greg Kurz wrote:
> Yet another round of sanitizing the error handling in spapr. I've
> identified locations that needed fixing with the errp-guard.cocci
> coccinelle script. It turns out that a better result is achieved
> by fixing manually, especially by converting some void functions
> to indicate success/failure with a return value.

1..4 applied to ppc-for-5.2, I'll look at the rest in due course.

> 
> Greg Kurz (15):
>   spapr: Fix error leak in spapr_realize_vcpu()
>   ppc: Add a return value to ppc_set_compat() and ppc_set_compat_all()
>   ppc: Fix return value in cpu_post_load() error path
>   spapr: Simplify error handling in callers of ppc_set_compat()
>   spapr: Get rid of cas_check_pvr() error reporting
>   spapr: Simplify error handling in do_client_architecture_support()
>   spapr: Simplify error handling in spapr_vio_busdev_realize()
>   spapr: Add a return value to spapr_drc_attach()
>   spapr: Simplify error handling in prop_get_fdt()
>   spapr: Add a return value to spapr_set_vcpu_id()
>   spapr: Simplify error handling in spapr_cpu_core_realize()
>   spapr: Add a return value to spapr_nvdimm_validate()
>   spapr: Add a return value to spapr_check_pagesize()
>   spapr: Simplify error handling in spapr_memory_plug()
>   spapr: Simplify error handling in spapr_memory_unplug_request()
> 
>  include/hw/ppc/spapr.h        |  4 +-
>  include/hw/ppc/spapr_drc.h    |  2 +-
>  include/hw/ppc/spapr_nvdimm.h |  4 +-
>  target/ppc/cpu.h              |  4 +-
>  hw/ppc/spapr.c                | 76 ++++++++++++-----------------------
>  hw/ppc/spapr_caps.c           |  7 +++-
>  hw/ppc/spapr_cpu_core.c       | 24 +++++------
>  hw/ppc/spapr_drc.c            | 17 ++++----
>  hw/ppc/spapr_hcall.c          | 34 +++++++---------
>  hw/ppc/spapr_nvdimm.c         | 24 +++++------
>  hw/ppc/spapr_pci.c            |  5 +--
>  hw/ppc/spapr_vio.c            | 12 +++---
>  target/ppc/compat.c           | 26 +++++++-----
>  target/ppc/machine.c          |  9 +++--
>  14 files changed, 108 insertions(+), 140 deletions(-)
>
David Gibson Sept. 17, 2020, 1:08 a.m. UTC | #2
On Wed, Sep 16, 2020 at 12:49:38PM +1000, David Gibson wrote:
> On Mon, Sep 14, 2020 at 02:34:50PM +0200, Greg Kurz wrote:
> > Yet another round of sanitizing the error handling in spapr. I've
> > identified locations that needed fixing with the errp-guard.cocci
> > coccinelle script. It turns out that a better result is achieved
> > by fixing manually, especially by converting some void functions
> > to indicate success/failure with a return value.
> 
> 1..4 applied to ppc-for-5.2, I'll look at the rest in due course.

5..13 now applied as well.

> 
> > 
> > Greg Kurz (15):
> >   spapr: Fix error leak in spapr_realize_vcpu()
> >   ppc: Add a return value to ppc_set_compat() and ppc_set_compat_all()
> >   ppc: Fix return value in cpu_post_load() error path
> >   spapr: Simplify error handling in callers of ppc_set_compat()
> >   spapr: Get rid of cas_check_pvr() error reporting
> >   spapr: Simplify error handling in do_client_architecture_support()
> >   spapr: Simplify error handling in spapr_vio_busdev_realize()
> >   spapr: Add a return value to spapr_drc_attach()
> >   spapr: Simplify error handling in prop_get_fdt()
> >   spapr: Add a return value to spapr_set_vcpu_id()
> >   spapr: Simplify error handling in spapr_cpu_core_realize()
> >   spapr: Add a return value to spapr_nvdimm_validate()
> >   spapr: Add a return value to spapr_check_pagesize()
> >   spapr: Simplify error handling in spapr_memory_plug()
> >   spapr: Simplify error handling in spapr_memory_unplug_request()
> > 
> >  include/hw/ppc/spapr.h        |  4 +-
> >  include/hw/ppc/spapr_drc.h    |  2 +-
> >  include/hw/ppc/spapr_nvdimm.h |  4 +-
> >  target/ppc/cpu.h              |  4 +-
> >  hw/ppc/spapr.c                | 76 ++++++++++++-----------------------
> >  hw/ppc/spapr_caps.c           |  7 +++-
> >  hw/ppc/spapr_cpu_core.c       | 24 +++++------
> >  hw/ppc/spapr_drc.c            | 17 ++++----
> >  hw/ppc/spapr_hcall.c          | 34 +++++++---------
> >  hw/ppc/spapr_nvdimm.c         | 24 +++++------
> >  hw/ppc/spapr_pci.c            |  5 +--
> >  hw/ppc/spapr_vio.c            | 12 +++---
> >  target/ppc/compat.c           | 26 +++++++-----
> >  target/ppc/machine.c          |  9 +++--
> >  14 files changed, 108 insertions(+), 140 deletions(-)
> > 
>