mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
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>
This commit is contained in:
parent
c525436e69
commit
84a3a53cf6
3 changed files with 34 additions and 13 deletions
|
@ -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]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue