From 840c2c4ed9645fe729321a53d76c5abd3fecc67b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 21 Oct 2025 13:02:37 +0400 Subject: [PATCH] hw/pcspk: check the "pit" is set MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We don't let the user create a "isa-pcspk" via -device yet (in theory, we could, and fallback on a lookup PIT), but we can add some safety checks that the property was correctly set nonetheless. Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20251021090317.425409-7-marcandre.lureau@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/audio/pcspk.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index 7b716c08ef..54fcf632e6 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -189,6 +189,11 @@ static void pcspk_realizefn(DeviceState *dev, Error **errp) ISADevice *isadev = ISA_DEVICE(dev); PCSpkState *s = PC_SPEAKER(dev); + if (!s->pit) { + error_setg(errp, "pcspk: No \"pit\" set or available"); + return; + } + isa_register_ioport(isadev, &s->ioport, s->iobase); if (s->card.state && AUD_register_card(s_spk, &s->card, errp)) { -- 2.47.3