[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/44] hw/qdev-clock: Display error hint when clock is missing fro
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 02/44] hw/qdev-clock: Display error hint when clock is missing from device |
Date: |
Sat, 17 Oct 2020 16:02:01 +0200 |
Instead of directly aborting, display a hint to help the developer
figure out the problem (likely trying to connect a clock to a device
pre-dating the Clock API, thus not expecting clocks).
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Luc Michel <luc@lmichel.fr>
Reviewed-by: Damien Hedde <damien.hedde@greensocs.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-Id: <20201012095804.3335117-4-f4bug@amsat.org>
---
hw/core/qdev-clock.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/hw/core/qdev-clock.c b/hw/core/qdev-clock.c
index 47ecb5b4fae..6a9a340d0fb 100644
--- a/hw/core/qdev-clock.c
+++ b/hw/core/qdev-clock.c
@@ -12,6 +12,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/error-report.h"
#include "hw/qdev-clock.h"
#include "hw/qdev-core.h"
#include "qapi/error.h"
@@ -153,6 +154,11 @@ Clock *qdev_get_clock_in(DeviceState *dev, const char
*name)
assert(name);
ncl = qdev_get_clocklist(dev, name);
+ if (!ncl) {
+ error_report("Can not find clock-in '%s' for device type '%s'",
+ name, object_get_typename(OBJECT(dev)));
+ abort();
+ }
assert(!ncl->output);
return ncl->clock;
@@ -165,6 +171,11 @@ Clock *qdev_get_clock_out(DeviceState *dev, const char
*name)
assert(name);
ncl = qdev_get_clocklist(dev, name);
+ if (!ncl) {
+ error_report("Can not find clock-out '%s' for device type '%s'",
+ name, object_get_typename(OBJECT(dev)));
+ abort();
+ }
assert(ncl->output);
return ncl->clock;
--
2.26.2
- [PULL 00/44] mips-next patches for 2020-10-17, Philippe Mathieu-Daudé, 2020/10/17
- [PULL 01/44] util/cutils: Introduce freq_to_str() to display Hertz units, Philippe Mathieu-Daudé, 2020/10/17
- [PULL 02/44] hw/qdev-clock: Display error hint when clock is missing from device,
Philippe Mathieu-Daudé <=
- [PULL 03/44] hw/core/clock: Add the clock_new helper function, Philippe Mathieu-Daudé, 2020/10/17
- [PULL 04/44] target/mips: Fix some comment spelling errors, Philippe Mathieu-Daudé, 2020/10/17
- [PULL 05/44] target/mips: Demacro helpers for <ABS|CHS>.<D|S|PS>, Philippe Mathieu-Daudé, 2020/10/17
- [PULL 06/44] target/mips: Demacro helpers for M<ADD|SUB>F.<D|S>, Philippe Mathieu-Daudé, 2020/10/17
- [PULL 07/44] target/mips: Demacro helpers for <MAX|MAXA|MIN|MINA>.<D|S>, Philippe Mathieu-Daudé, 2020/10/17
- [PULL 09/44] target/mips: Add loongson-ext lswc2 group of instructions (Part 2), Philippe Mathieu-Daudé, 2020/10/17
- [PULL 11/44] target/mips/op_helper: Convert multiple if() to switch case, Philippe Mathieu-Daudé, 2020/10/17
- [PULL 12/44] target/mips/op_helper: Document Invalidate/Writeback opcodes as no-op, Philippe Mathieu-Daudé, 2020/10/17
- [PULL 08/44] target/mips: Add loongson-ext lswc2 group of instructions (Part 1), Philippe Mathieu-Daudé, 2020/10/17
- [PULL 10/44] target/mips: Add loongson-ext lsdc2 group of instructions, Philippe Mathieu-Daudé, 2020/10/17