diff options
author | Markus Armbruster <armbru@redhat.com> | 2015-12-17 17:35:10 +0100 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2019-11-29 19:28:24 -0600 |
commit | 6ff690a7e4cf44be641f256cd44e31f9dde9cddc (patch) | |
tree | b926509ad73ea5e3b5799adf7b177b6b80da9c12 /hw/i2c | |
parent | 5ae6bf705b62d3908fa0b898eb7fd92fe0649452 (diff) | |
download | hqemu-6ff690a7e4cf44be641f256cd44e31f9dde9cddc.zip hqemu-6ff690a7e4cf44be641f256cd44e31f9dde9cddc.tar.gz |
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/i2c')
-rw-r--r-- | hw/i2c/omap_i2c.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/hw/i2c/omap_i2c.c b/hw/i2c/omap_i2c.c index b6f544a..8b0b146 100644 --- a/hw/i2c/omap_i2c.c +++ b/hw/i2c/omap_i2c.c @@ -20,6 +20,7 @@ #include "hw/i2c/i2c.h" #include "hw/arm/omap.h" #include "hw/sysbus.h" +#include "qemu/error-report.h" #define TYPE_OMAP_I2C "omap_i2c" #define OMAP_I2C(obj) OBJECT_CHECK(OMAPI2CState, (obj), TYPE_OMAP_I2C) @@ -449,12 +450,15 @@ static int omap_i2c_init(SysBusDevice *sbd) OMAPI2CState *s = OMAP_I2C(dev); if (!s->fclk) { - hw_error("omap_i2c: fclk not connected\n"); + error_report("omap_i2c: fclk not connected"); + return -1; } if (s->revision >= OMAP2_INTR_REV && !s->iclk) { /* Note that OMAP1 doesn't have a separate interface clock */ - hw_error("omap_i2c: iclk not connected\n"); + error_report("omap_i2c: iclk not connected"); + return -1; } + sysbus_init_irq(sbd, &s->irq); sysbus_init_irq(sbd, &s->drq[0]); sysbus_init_irq(sbd, &s->drq[1]); |