From: Marc-André Lureau Date: Tue, 21 Oct 2025 09:02:37 +0000 (+0400) Subject: hw/pcspk: check the "pit" is set X-Git-Tag: v10.2.0-rc1~53^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=840c2c4ed9645fe729321a53d76c5abd3fecc67b;p=thirdparty%2Fqemu.git hw/pcspk: check the "pit" is set 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é --- 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)) {