All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org
Cc: "Damien Hedde" <damien.hedde@greensocs.com>,
	"Huacai Chen" <zltjiangshi@gmail.com>,
	"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
	"Edgar E . Iglesias" <edgar.iglesias@xilinx.com>,
	"Luc Michel" <luc@lmichel.fr>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Paul Burton" <paulburton@kernel.org>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Hervé Poussineau" <hpoussin@reactos.org>,
	"Huacai Chen" <chenhc@lemote.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	"Richard Henderson" <rth@twiddle.net>
Subject: [PATCH v4 03/21] hw/qdev-clock: Display error hint when clock is missing from device
Date: Mon, 12 Oct 2020 11:57:46 +0200	[thread overview]
Message-ID: <20201012095804.3335117-4-f4bug@amsat.org> (raw)
In-Reply-To: <20201012095804.3335117-1-f4bug@amsat.org>

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).

Reviewed-by: Luc Michel <luc@lmichel.fr>
Reviewed-by: Damien Hedde <damien.hedde@greensocs.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Philippe Mathieu-Daudé <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



  parent reply	other threads:[~2020-10-12  9:59 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-12  9:57 [PATCH v4 00/21] hw/mips: Set CPU frequency Philippe Mathieu-Daudé
2020-10-12  9:57 ` [PATCH v4 01/21] util/cutils: Introduce freq_to_str() to display Hertz units Philippe Mathieu-Daudé
2020-10-12  9:57 ` [PATCH v4 02/21] qdev-monitor: Display frequencies scaled to SI unit Philippe Mathieu-Daudé
2020-10-12  9:57 ` Philippe Mathieu-Daudé [this message]
2020-10-12  9:57 ` [PATCH v4 04/21] hw/core/clock: add the clock_new helper function Philippe Mathieu-Daudé
2020-10-12  9:57 ` [PATCH v4 05/21] target/mips: Move cpu_mips_get_random() with CP0 helpers Philippe Mathieu-Daudé
2020-10-12  9:57 ` [PATCH v4 06/21] target/mips/cp0_timer: Explicit unit in variable name Philippe Mathieu-Daudé
2020-10-12  9:57 ` [PATCH v4 07/21] target/mips/cp0_timer: Document TIMER_PERIOD origin Philippe Mathieu-Daudé
2020-10-12  9:57 ` [PATCH v4 08/21] target/mips: Move cp0_count_ns to CPUMIPSState Philippe Mathieu-Daudé
2020-10-12  9:57 ` [PATCH v4 09/21] target/mips/cpu: Calculate the CP0 timer period using the CPU frequency Philippe Mathieu-Daudé
2020-10-12  9:57 ` [PATCH v4 10/21] target/mips/cpu: Make cp0_count_rate a property Philippe Mathieu-Daudé
2020-10-12  9:57 ` [PATCH v4 11/21] target/mips/cpu: Allow the CPU to use dynamic frequencies Philippe Mathieu-Daudé
2020-10-12  9:57 ` [PATCH v4 12/21] target/mips/cpu: Introduce mips_cpu_create_with_clock() helper Philippe Mathieu-Daudé
2020-10-12  9:57 ` [PATCH v4 13/21] hw/mips/r4k: Explicit CPU frequency is 200 MHz Philippe Mathieu-Daudé
2020-10-12  9:57 ` [PATCH v4 14/21] hw/mips/fuloong2e: Set CPU frequency to 533 MHz Philippe Mathieu-Daudé
2020-10-12  9:57 ` [PATCH v4 15/21] hw/mips/mipssim: Correct CPU frequency Philippe Mathieu-Daudé
2020-10-12  9:57 ` [PATCH v4 16/21] hw/mips/jazz: Correct CPU frequencies Philippe Mathieu-Daudé
2020-10-12  9:58 ` [PATCH v4 17/21] hw/mips/cps: Expose input clock and connect it to CPU cores Philippe Mathieu-Daudé
2020-10-12  9:58 ` [PATCH v4 18/21] hw/mips/boston: Set CPU frequency to 1 GHz Philippe Mathieu-Daudé
2020-10-12  9:58 ` [PATCH v4 19/21] hw/mips/malta: Set CPU frequency to 320 MHz Philippe Mathieu-Daudé
2020-10-12  9:58 ` [PATCH v4 20/21] hw/mips/cps: Do not allow use without input clock Philippe Mathieu-Daudé
2020-10-12  9:58 ` [PATCH v4 21/21] target/mips/cpu: Display warning when CPU is used " Philippe Mathieu-Daudé
2020-10-16 16:45 ` [PATCH v4 00/21] hw/mips: Set CPU frequency Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201012095804.3335117-4-f4bug@amsat.org \
    --to=f4bug@amsat.org \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=alex.bennee@linaro.org \
    --cc=aurelien@aurel32.net \
    --cc=berrange@redhat.com \
    --cc=chenhc@lemote.com \
    --cc=damien.hedde@greensocs.com \
    --cc=edgar.iglesias@xilinx.com \
    --cc=ehabkost@redhat.com \
    --cc=hpoussin@reactos.org \
    --cc=luc@lmichel.fr \
    --cc=paulburton@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=zltjiangshi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.