spapr: Simplify error handling in spapr_phb_realize()
commit4a6891b838e4914d25ab97a2a03f946e3c085a8f
authorGreg Kurz <groug@kaod.org>
Mon, 10 Aug 2020 16:53:58 +0000 (10 18:53 +0200)
committerDavid Gibson <david@gibson.dropbear.id.au>
Thu, 13 Aug 2020 11:00:52 +0000 (13 21:00 +1000)
tree4d11c70547a8faa4d3b04b2ef127b26afcdad116
parenta4907119348d928e8b72e2d3b7566e50f272fa09
spapr: Simplify error handling in spapr_phb_realize()

The spapr_phb_realize() function has a local_err variable which
is used to:

1) check failures of spapr_irq_findone() and spapr_irq_claim()

2) prepend extra information to the error message

Recent work from Markus Armbruster highlighted we get better
code when testing the return value of a function, rather than
setting up all the local_err boiler plate. For similar reasons,
it is now preferred to use ERRP_GUARD() and error_prepend()
rather than error_propagate_prepend().

Since spapr_irq_findone() and spapr_irq_claim() return negative
values in case of failure, do both changes.

This is just cleanup, no functional impact.

Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <159707843851.1489912.6108405733810934642.stgit@bahia.lan>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/ppc/spapr_pci.c