diff options
author | Markus Armbruster <armbru@redhat.com> | 2015-12-17 17:35:10 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2016-01-13 11:58:58 +0100 |
commit | 84a3a53cf61ef691478bd91afa455c801696053c (patch) | |
tree | 72425d317b2f9c0ca660ad73d84568695c7bf743 /hw/intc/omap_intc.c | |
parent | c525436e69bb7e74ca96982a40b8ead037186049 (diff) |
omap: Don't use hw_error() in device init() methods
Device init() methods aren't supposed to call hw_error(), they should
report the error and fail cleanly. Do that.
The errors are all device misconfiguration. All callers use
qdev_init_nofail(), so this patch merely converts hw_error() crashes
into &error_abort crashes. Improvement, because now it crashes closer
to where the misconfiguration bug would be, and a few more bad
examples of hw_error() use are gone.
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <1450370121-5768-3-git-send-email-armbru@redhat.com>
Diffstat (limited to 'hw/intc/omap_intc.c')
-rw-r--r-- | hw/intc/omap_intc.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/hw/intc/omap_intc.c b/hw/intc/omap_intc.c index e9b38a3c63..07b6272b09 100644 --- a/hw/intc/omap_intc.c +++ b/hw/intc/omap_intc.c @@ -20,6 +20,7 @@ #include "hw/hw.h" #include "hw/arm/omap.h" #include "hw/sysbus.h" +#include "qemu/error-report.h" /* Interrupt Handlers */ struct omap_intr_handler_bank_s { @@ -367,7 +368,8 @@ static int omap_intc_init(SysBusDevice *sbd) struct omap_intr_handler_s *s = OMAP_INTC(dev); if (!s->iclk) { - hw_error("omap-intc: clk not connected\n"); + error_report("omap-intc: clk not connected"); + return -1; } s->nbanks = 1; sysbus_init_irq(sbd, &s->parent_intr[0]); @@ -608,10 +610,12 @@ static int omap2_intc_init(SysBusDevice *sbd) struct omap_intr_handler_s *s = OMAP_INTC(dev); if (!s->iclk) { - hw_error("omap2-intc: iclk not connected\n"); + error_report("omap2-intc: iclk not connected"); + return -1; } if (!s->fclk) { - hw_error("omap2-intc: fclk not connected\n"); + error_report("omap2-intc: fclk not connected"); + return -1; } s->level_only = 1; s->nbanks = 3; |