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 <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20251021090317.425409-7-marcandre.lureau@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
Marc-André Lureau
2025-10-22 08:55:28 +02:00
committed by Philippe Mathieu-Daudé
parent 64a013e18b
commit 840c2c4ed9
+5
View File
@@ -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)) {