From patchwork Fri Oct 20 17:15:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 736283 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp418887wrl; Fri, 20 Oct 2023 10:16:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGSNQCiBN3adVCBlvz9O3LwQaAZLqQVrp7DJU495VRMEzmTyAchiwUolioEuQnxrDLIrQc/ X-Received: by 2002:ad4:5e8e:0:b0:66d:2904:955c with SMTP id jl14-20020ad45e8e000000b0066d2904955cmr2839704qvb.18.1697822197956; Fri, 20 Oct 2023 10:16:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697822197; cv=none; d=google.com; s=arc-20160816; b=GVHbWRQnXWjX8kS7iMrBuxUAoaN8YjGJ4IuN1PIPe3qrOo1GDnLg3xFItw5yFX+np4 0ocFOvDezi33mQGHs8NURFX75wkVf7yNpzB7jvIGsNCDri3P290xzk2MhyN+94Xi/bWe 2Dhu/FX93eW+I2hq9BwOajRl89qo6jfpMthoPDhpL9m/JjbXLQdtnZQ2XWoCBs7owpzZ WOuBAjcuJ/MFsvFRuv86uq/TSbP6K78SHqTCAIXwpstupbooTWSzCBRA/N2wT884KejN cQSEA7ehx+VBiQbd3c3WY8fTvqc8Mkgrv3S1dagh0PcPimW4RahMGiwV+nmj2bhSJYkX 5Oiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=X8OmoVLEg4TfDxQv28vslF4GB3HmpguafbZuBCuHq6Y=; fh=vahbnPf8qxI+crNjrrm0XuHs+0rRTYj56fMpuqbJh04=; b=WNE0jNzZMt7byDqavW1lO03w0zbP38P43WK5bmTqBFGv5cItvnf6YSeADphqmXwpnJ ZsiLO9t8Ia71kk7xc449e/Na1teXcnTRPhTAqxTUoCJKGseJTLnhsDJMQu5mjsBgtCb1 /6ybyy23Ct8ehrTUbin4QzElOpLPWT/RfWnHXntqX6Znr75xvRhQfY8XlMzEyrC4GMPd BJzkeOoQFe+nXuOEFWqdG9s3XQzp+TbNX6ag+a3W3hJiCbTbwyIN6EBJ+AfaWbRyb6Nn sGQv3Eiekr1pN/0kaTMzxpTQ1y5aHa+wghFS0HEzkz/2YsCz8g+U5G4a2vX8YtA4BATL 7YWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JhBhlq3n; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l21-20020a05620a211500b0077437859066si1492078qkl.7.2023.10.20.10.16.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 10:16:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JhBhlq3n; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtt5m-0000pX-Er; Fri, 20 Oct 2023 13:15:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtt5l-0000mM-Bz for qemu-devel@nongnu.org; Fri, 20 Oct 2023 13:15:21 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtt5j-0004Sr-EG for qemu-devel@nongnu.org; Fri, 20 Oct 2023 13:15:21 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4064876e8b8so8975175e9.0 for ; Fri, 20 Oct 2023 10:15:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697822118; x=1698426918; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=X8OmoVLEg4TfDxQv28vslF4GB3HmpguafbZuBCuHq6Y=; b=JhBhlq3ntrJPytQrRcj9v+2IU+s8/uTnfLdHJZG3g32/yhlDzjYBA2y3vJrFBzByaN Dog+S+oOvhjNO0/4V3Z/ZTe4CNrMnR4Pcv+xBfhKnSvwgTy3WkTb3sjwtEkC0xg3yST9 oXG1nT3Y7HKCfMshELLBKGgCKw/zROsNYoj7+UyjQLx4/9z+VfMj1EP8Ney0XKfRz7cZ nIFC6bTNgfCuHrRR+Y2LYg0hU57OzQoYuxYxIE0ZtUQQWv/gzyfv0gOBtSjgfwcY+yTB QtqVi1/0VxZvam0QWWWM6AwLSq/WZsIKtwL7Ix2cNRnQKefapMZ911lqkcu+wyrxxrzD 1XDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697822118; x=1698426918; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=X8OmoVLEg4TfDxQv28vslF4GB3HmpguafbZuBCuHq6Y=; b=sjBqCM15+Jg1FUZ1UtWQBr6vXlrYIxXLmULIpuxQEBddAsMiQRGDUM5THP+Nee5qAO jfS7hgug1dtGe3Tr4qXHuFfpZKzDLo1uKcFr0zR6W27HmqraFn6ncSxIlp3vGjWpO1Q+ dORIoER2EBRFvvgnv0tR/r6Am7TeHnQEuZzqUk2skoRxh7+MAnVTkcx9pVdWuKvwF1JY u3Dvg+NpMyX51j8WHCyxPAJSmZE9RpIsw/3YEFtm3JaFltKB4tslbCdJn6UQANEURTkd jgSJ8NJv9FEEyD82kkcQ3GU1bWQmxTwVfUl5gB5q5kU7FTjl/KYK6nxSY5AepA8wN3bl YHoA== X-Gm-Message-State: AOJu0Yz4ylfJxK7W2l0gE3bF+eJU87/eV0+PuwGnXsRZd/suYYyFFIHa HE95MDHGzZP2OunH6jWiBr8ty/virymMSjXA81E= X-Received: by 2002:a05:600c:19cb:b0:407:5adc:4497 with SMTP id u11-20020a05600c19cb00b004075adc4497mr1871420wmq.9.1697822117728; Fri, 20 Oct 2023 10:15:17 -0700 (PDT) Received: from m1x-phil.lan (tbo33-h01-176-171-212-97.dsl.sta.abo.bbox.fr. [176.171.212.97]) by smtp.gmail.com with ESMTPSA id f4-20020a5d50c4000000b0032da319a27asm2117375wrt.9.2023.10.20.10.15.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Oct 2023 10:15:17 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , "Michael S. Tsirkin" , Richard Henderson , Markus Armbruster , Bernhard Beschow , qemu-ppc@nongnu.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Paolo Bonzini , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v4 1/4] hw/i386/pc: Pass Error** argument to pc_basic_device_init() Date: Fri, 20 Oct 2023 19:15:05 +0200 Message-ID: <20231020171509.87839-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231020171509.87839-1-philmd@linaro.org> References: <20231020171509.87839-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org pc_basic_device_init() creates devices which can fail, allow to propagate error to caller. Suggested-by: Markus Armbruster Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- include/hw/i386/pc.h | 5 +++-- hw/i386/pc.c | 7 +++++-- hw/i386/pc_piix.c | 2 +- hw/i386/pc_q35.c | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index bec38cb92c..069c27368d 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -174,11 +174,12 @@ void pc_memory_init(PCMachineState *pcms, uint64_t pci_hole64_size); uint64_t pc_pci_hole64_start(void); DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus); -void pc_basic_device_init(struct PCMachineState *pcms, +bool pc_basic_device_init(struct PCMachineState *pcms, ISABus *isa_bus, qemu_irq *gsi, ISADevice *rtc_state, bool create_fdctrl, - uint32_t hpet_irqs); + uint32_t hpet_irqs, + Error **errp); void pc_cmos_init(PCMachineState *pcms, BusState *ide0, BusState *ide1, ISADevice *s); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index f7ee638bec..2481c11e83 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1189,11 +1189,12 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, g_free(a20_line); } -void pc_basic_device_init(struct PCMachineState *pcms, +bool pc_basic_device_init(struct PCMachineState *pcms, ISABus *isa_bus, qemu_irq *gsi, ISADevice *rtc_state, bool create_fdctrl, - uint32_t hpet_irqs) + uint32_t hpet_irqs, + Error **errp) { int i; DeviceState *hpet = NULL; @@ -1291,6 +1292,8 @@ void pc_basic_device_init(struct PCMachineState *pcms, /* Super I/O */ pc_superio_init(isa_bus, create_fdctrl, pcms->i8042_enabled, pcms->vmport != ON_OFF_AUTO_ON); + + return true; } void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index e36a3262b2..0d9cdf773e 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -320,7 +320,7 @@ static void pc_init1(MachineState *machine, /* init basic PC hardware */ pc_basic_device_init(pcms, isa_bus, x86ms->gsi, rtc_state, true, - 0x4); + 0x4, &error_fatal); pc_nic_init(pcmc, isa_bus, pci_bus); diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index a7386f2ca2..e4b05e3139 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -301,7 +301,7 @@ static void pc_q35_init(MachineState *machine) /* init basic PC hardware */ pc_basic_device_init(pcms, isa_bus, x86ms->gsi, rtc_state, !mc->no_floppy, - 0xff0104); + 0xff0104, &error_fatal); if (pcms->sata_enabled) { /* ahci and SATA device, for q35 1 ahci controller is built-in */ From patchwork Fri Oct 20 17:15:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 736281 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp418880wrl; Fri, 20 Oct 2023 10:16:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFcPH2koPI4/p8N5S69Jv8kbyz9u+5r9GrpKSVGpC8RwdW4zX2PmKUnkgobHvwT0vG9nxJC X-Received: by 2002:a05:620a:4509:b0:76c:fc7c:ac5e with SMTP id t9-20020a05620a450900b0076cfc7cac5emr2498097qkp.74.1697822197766; Fri, 20 Oct 2023 10:16:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697822197; cv=none; d=google.com; s=arc-20160816; b=RSk7+s+YPDLrZ18Cra7Ien0DFq2TcXefr1WHk7d8uJYydT3nMNuvwUckhdzK1y0uCi Rn6y5AXjc9ZFvgjLyqpNN9E21CUqtpYuUT7sK0FzxqPp36sXdEwlYWVSs4i1sEN2EHDJ 4Z6OVPep0dBDqMwBrj/tqEg5/8GjWDUikr8IYjOfrk+sWUJZaW5GIVmMD625AVqQhhIE /sYvZeAG9SZlgfJRT+X/PuitNGxYW6rgjsMcx4cm+rIc3lXlKetGJJqBr2yfp0nocne8 Tmmfwqpc4/l/ITYWnhUKVtLkCj2jQ44WCHP0rl7ZWfPdCPQ90aX9C21QuujZqKT5Bgq0 hjTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5BLTImRtSBPYrMBQyYLLw+0mHiY20kiyEXYbycXjLtY=; fh=vahbnPf8qxI+crNjrrm0XuHs+0rRTYj56fMpuqbJh04=; b=0WLu0aD2yaW68uJtiy9WVgIEAMNN83mHaOTlRYIMjmJU/1OsCK1nw51YI7UG8lgG5f EAeJMxDWev+1+iqsu/OyMLN5uhMM+b/YhwLEGcUuiibnUJEabP0lsf/dnR6R5EXhPu4o Cs1FXonVmHnz6dALfN0ep7tKY19NgqKZihJyGPoQZiWHCzowM5ccBTE3f/3vGihsUbkk VRR2PKGvtm2f9axwA1nB24lFmxItTTbfNATMQaxDnapVHcqDrpUmHm4betJGDdibc5eJ 1gXmDm8jCL6i+eLrfDb0sk1wut304Q1LrPHzZPBQC1sSXrnLN9MB3bKbwIYt6evO0MnZ VOIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FvYQfxXa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u25-20020a05620a085900b00775da6eacb2si1639165qku.19.2023.10.20.10.16.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 10:16:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FvYQfxXa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtt5s-0000zt-9L; Fri, 20 Oct 2023 13:15:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtt5q-0000z4-VK for qemu-devel@nongnu.org; Fri, 20 Oct 2023 13:15:27 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtt5p-0004WC-3R for qemu-devel@nongnu.org; Fri, 20 Oct 2023 13:15:26 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4079ed65582so8383385e9.1 for ; Fri, 20 Oct 2023 10:15:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697822123; x=1698426923; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5BLTImRtSBPYrMBQyYLLw+0mHiY20kiyEXYbycXjLtY=; b=FvYQfxXabcpk1sW37/1ctcNOMYI+jZc+XfiGHeuJkLiREPPhUNMzp7A2bEsW5lRDZb yuJc1qwKGKqjb7cBNPESwBWFNdJNCVhozAGR4BrdiqSP6L72YEUq804cFPC42kO+AVPu CgGWrZl5l832XnuL1b2V7XokiB5/c4b66DOTyp9OSQcOOcg4hoIn4o4tG6gT+VvNf2PI SpAhZIf6iIp7kJzagdqwKcp3jAI5oLVYJQm8M2AKLz983VHHT5j62CYb1YZBHbyiBLuc xLVkl/ffppTYonldbR851nV5P9Gqr1EnyRkbh4Mf4/aa/AKX+w13JDl6mbyHK0G4Sc2c Agiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697822123; x=1698426923; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5BLTImRtSBPYrMBQyYLLw+0mHiY20kiyEXYbycXjLtY=; b=UieQVLvn3CgO/3fU3krOIm0Jeld/tENzgOEq1W+yfuN/tV9fl+9SlsIQ+P7dD2hlXU 4rNSM8F5bAHcfQcj9ugP3EpZDVkKhcPz248BkA2dwCY2cJpC+a4Sq4n2nvg9hsw4nvS+ OxdWCPGvW9Wrqpkucu6xUs4NyMWVir9lDZ32lvTTiv3OCb+zEDm2tdUSyEdpY+JAi7ct ktvX85inYd6HE+8kG7XnpaJyzE/z/OuJHW3RANraPqAlmiCfHsD2SoJwSF5EzFCSKLxh Y3eP+GpJT/hxkWgBQzYjQlhmGFvZBfka9DzzTMKU67g4l+h5uH40VfFKM3x9umy8mSXV DaUw== X-Gm-Message-State: AOJu0YzWyni0O/39Yr5QreifzltlJ+5kc0CrSby7w3C4M4YHKNyEwIwI Wd+5iuVVziA8BD1DPryR1wjtxxfZWEjRKFtbNqM= X-Received: by 2002:adf:fd4e:0:b0:32d:89c5:45b6 with SMTP id h14-20020adffd4e000000b0032d89c545b6mr1803987wrs.38.1697822123574; Fri, 20 Oct 2023 10:15:23 -0700 (PDT) Received: from m1x-phil.lan (tbo33-h01-176-171-212-97.dsl.sta.abo.bbox.fr. [176.171.212.97]) by smtp.gmail.com with ESMTPSA id g7-20020a5d6987000000b003232380ffd7sm2087145wru.102.2023.10.20.10.15.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Oct 2023 10:15:23 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , "Michael S. Tsirkin" , Richard Henderson , Markus Armbruster , Bernhard Beschow , qemu-ppc@nongnu.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Paolo Bonzini , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v4 2/4] hw/i386/pc: Propagate error if HPET device creation failed Date: Fri, 20 Oct 2023 19:15:06 +0200 Message-ID: <20231020171509.87839-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231020171509.87839-1-philmd@linaro.org> References: <20231020171509.87839-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reported-by: Bernhard Beschow Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/i386/pc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 2481c11e83..6750ed427a 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1235,7 +1235,9 @@ bool pc_basic_device_init(struct PCMachineState *pcms, if (!compat) { qdev_prop_set_uint32(hpet, HPET_INTCAP, hpet_irqs); } - sysbus_realize_and_unref(SYS_BUS_DEVICE(hpet), &error_fatal); + if (!sysbus_realize_and_unref(SYS_BUS_DEVICE(hpet), errp)) { + return false; + } sysbus_mmio_map(SYS_BUS_DEVICE(hpet), 0, HPET_BASE); for (i = 0; i < IOAPIC_NUM_PINS; i++) { From patchwork Fri Oct 20 17:15:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 736285 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp418961wrl; Fri, 20 Oct 2023 10:16:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEr9esSvnLcrUSmNvIkYYGjssp5k+N6t7O6lJP1fj0wBREgmi5cjuePw/l4cOfzLoJe9BWY X-Received: by 2002:a05:6214:21a5:b0:66d:173a:aca7 with SMTP id t5-20020a05621421a500b0066d173aaca7mr2354430qvc.55.1697822209453; Fri, 20 Oct 2023 10:16:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697822209; cv=none; d=google.com; s=arc-20160816; b=cgNd1kxgHgzsjO86OZlIxfDWhaPv7eDcONHDZkUNFzaOkb+Ms0fWkI1f8hwK2jeZgZ lfwR5OtI3IOMAFOGbNxATkyKFHLcg+aapG7ggEUs7/KkDjNjhswUEqhiCiWHUuZV6qVT xsS6t4VUP1D0Jf+RG3sYDG/BOa/JgDTD8RST2Fuw5kKsxzv/Qs/DU/8tOpgb8nuGp0m8 iQuaAJXDN07ZzBCH4dtJBtAYahkJUHITM7VH+Pa2dwqTXdBUWfweQ/F37gns8+SU/6K+ Y/3M5fVJwatg86T1/CsxXx5s1hnO+0CWMvDHKbFHMe2DIEWqtWDVSemO4ifwhIRhajJZ 4Zzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=86FXsRfIWc3qxKloJ/dq3J9FNZepHuMpnW+a6InquQ8=; fh=vahbnPf8qxI+crNjrrm0XuHs+0rRTYj56fMpuqbJh04=; b=QevZTeWkEULJAToewYvwU+lh9jtezj1KIkkniqlNOud8qZFo03u/CPHR5LCYXEv50e tsBEl92TFrpIN6xq/uu03q5puK97LCD4XqTktx2GdmhE3Lvbj9bz9a+mxQvNYJtr44OL ZBQo/hy1km7THrmf2/y1DukNVSx0XCOzx8MJzjGrVezefBYAlEiqbjb6Q/gBmFRFzQsq aMF6AsNzYU69igHrOAMMNeZfyE7XiNi5kfj2vbfPnoaKd34bmmnYc11wkCI+1TmI5Kse A8Re7Uh3eJXWmZSvBqwC6n26xxERRsPsEnYXG4SW0NbttTE4PgJg6zhsBeEJzijF3URs BJ0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VHnFdgn6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id qh4-20020a0562144c0400b0065ae5abb042si1663747qvb.85.2023.10.20.10.16.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 10:16:49 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VHnFdgn6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtt5z-00016s-1O; Fri, 20 Oct 2023 13:15:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtt5w-00016F-UH for qemu-devel@nongnu.org; Fri, 20 Oct 2023 13:15:32 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtt5v-0004YW-BT for qemu-devel@nongnu.org; Fri, 20 Oct 2023 13:15:32 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-32ddfb38c02so770131f8f.3 for ; Fri, 20 Oct 2023 10:15:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697822129; x=1698426929; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=86FXsRfIWc3qxKloJ/dq3J9FNZepHuMpnW+a6InquQ8=; b=VHnFdgn6lROJNcOiLuCyNbyoLZ/73pu7GmxS/uzXZynNg+2bmDY0dtePQMT1V8b48F dSLRfMdFkGczI2gSQvjVuu3mls2yLSEhkRhpE4K4xJNS6LX5eRE/e9YD86USZgBJQzM3 WxlQhhEdEekfX7AG5BaiIBC8xc4K9zAP7w8z/2PNiX4xB1Re6rCJCMvSw10seuxZydpE pRmfLmcbUPtsBKbJFA8UFCao5/ML5/hC1u2f1++JZJ8bdnLJtIHm1yazP0Kce1pad/vK 3Pc3YovQiOTxlYBKATpzZI40vosfP5ggCtZiaX0w6dSiLSf6z6cThjG9ik3NvVZ1t2YN CrDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697822129; x=1698426929; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=86FXsRfIWc3qxKloJ/dq3J9FNZepHuMpnW+a6InquQ8=; b=JnELNKwRvzhzKLRRyFR+H1NUxZVAQMbeIyfBUlN2j+Ab2vpjP1fJUxL+UUUgGSd4wF PZu8UoHoa/07j9hRN+PJ6mBLcIM2pJH++dOJpdAaPUBYvNO21AGDkdWTRNE/fYI95AlF KNYkTxJYJubLpRDhwTSGqWKUdRBQ/z7Zo7xmFIgrt9zXeAap4XvQsz1fj9vG1SsbT31a z64yOgpAV3piR+PI7M9FgPKqXWEb3eMvVYm2KSS1MFwskRuFFQTPpjnbSkRVxt/JPE2+ bPWP1AeYt+aihI2xyRsgTPgKFf0NBTAdxIkSHiZptLyYW0OGageWOJdeODV7SobGJcWI BvZw== X-Gm-Message-State: AOJu0YzdP8Bcge7CWvmGrOVKg2RnrmY6/3AmNPXiWOEnSa140Aj9cwPW e7o4E76acjSW7P8jlNUT7ADCXn7PZkMDiNc+bDg= X-Received: by 2002:a05:6000:1244:b0:32d:a409:84c8 with SMTP id j4-20020a056000124400b0032da40984c8mr1842604wrx.67.1697822129434; Fri, 20 Oct 2023 10:15:29 -0700 (PDT) Received: from m1x-phil.lan (tbo33-h01-176-171-212-97.dsl.sta.abo.bbox.fr. [176.171.212.97]) by smtp.gmail.com with ESMTPSA id x18-20020a5d60d2000000b003248a490e3asm2076532wrt.39.2023.10.20.10.15.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Oct 2023 10:15:29 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , "Michael S. Tsirkin" , Richard Henderson , Markus Armbruster , Bernhard Beschow , qemu-ppc@nongnu.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Paolo Bonzini , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v4 3/4] hw/i386/pc: Propagate error if PC_SPEAKER device creation failed Date: Fri, 20 Oct 2023 19:15:07 +0200 Message-ID: <20231020171509.87839-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231020171509.87839-1-philmd@linaro.org> References: <20231020171509.87839-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org In commit 40f8214fcd ("hw/audio/pcspk: Inline pcspk_init()") we neglected to give a change to the caller to handle failed device creation cleanly. Here this can not happen because pc_basic_device_init() uses &error_fatal. Anyhow, do the proper error reporting to avoid bad code example spreading. Reported-by: Bernhard Beschow Suggested-by: Markus Armbruster Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/i386/pc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 6750ed427a..3937d88355 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1288,7 +1288,9 @@ bool pc_basic_device_init(struct PCMachineState *pcms, } object_property_set_link(OBJECT(pcms->pcspk), "pit", OBJECT(pit), &error_fatal); - isa_realize_and_unref(pcms->pcspk, isa_bus, &error_fatal); + if (!isa_realize_and_unref(pcms->pcspk, isa_bus, errp)) { + return false; + } } /* Super I/O */ From patchwork Fri Oct 20 17:15:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 736282 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp418882wrl; Fri, 20 Oct 2023 10:16:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFkiKGDlxJdsn0SIGJIu/DjxwvcanvFMKcuwMs4d9lJtrWcPEM4prOMgorH5+zOXfoGSiPf X-Received: by 2002:a05:620a:284a:b0:778:91ee:a9fb with SMTP id h10-20020a05620a284a00b0077891eea9fbmr2608392qkp.5.1697822197695; Fri, 20 Oct 2023 10:16:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697822197; cv=none; d=google.com; s=arc-20160816; b=ucuLqchpEQFS0mwxy6JfFNnUif9qvfFUT3NudTRni033lP6IoqnbZH0oQQLmYep6Vd egPKkwud5UmL0g9FnBQwiwc0YGw/AG5uA3nBCACCEhhrCvMxZ1JAKehZgMYyad2vdvnH ztjhEZG1FanQeRh/4wVcN909Rfc6dxYJgkAdH82AuX4PD9cp1S5j0qzPsC8mroCW2Fxl EC0yw1HwF6pVsVETrmk1ce2qCjXJ4r1l3886eiP/CIb3MS2cLqjBFt+xbss7nB3zo2fM 2wNpizmT48c0zYScABYC01h6UEmdurJrntQ47/GWq+mhwEAEIbhzMhVGDl/7iT6VtCjk sxSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hxDbAKxZshnw2aCKoDntFb9lK0/E0E536iU7q/e3O4Q=; fh=vahbnPf8qxI+crNjrrm0XuHs+0rRTYj56fMpuqbJh04=; b=V/zkDDzLeoff8xyN+X74ugJ7xWw9XH9cAXy3u3PXWqZDxMJAuQoelFTm0VT5o08oAk fF6X/L/pKdd+0zynO6SsBDfRq6hOqjVucI9d7K1ymudZYnBdtdl7GOAhZyw+grZxs40n zPad/lxlJTyJIYmgN6KM2OmhlqTEv9KW25s+BvAmOE7QY8JxqMMSVTEhNB+pXV6FOEGa 1cTVppWQp5IWlr1WmKjlcMxysNkqkaNHZNuk0CTKSaHoEH0lWtRMw0HiVuHNmHKPXCtU KPJLQE6dtbyge+QoZQBdH36uvASuEPEsMitJ9toXQrkEscM+ERTLbROjjZEq4C/VTRF+ JotQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VmlTd0mb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s3-20020a05620a0bc300b00778a5de9072si1621941qki.750.2023.10.20.10.16.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 10:16:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VmlTd0mb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtt6T-0001Lu-EU; Fri, 20 Oct 2023 13:16:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtt6A-0001Bp-7e for qemu-devel@nongnu.org; Fri, 20 Oct 2023 13:15:47 -0400 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtt68-0004Z0-Fa for qemu-devel@nongnu.org; Fri, 20 Oct 2023 13:15:45 -0400 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-507b96095abso1494687e87.3 for ; Fri, 20 Oct 2023 10:15:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697822135; x=1698426935; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hxDbAKxZshnw2aCKoDntFb9lK0/E0E536iU7q/e3O4Q=; b=VmlTd0mb7FXAg4+pnW9Ea5Vb5D1pTmy7FOuIk68qWYKpAcJjflZmOLdhRV2AtTp7Uo mKTT4PtcFKlFjdVFpWZur0nsvKO+oeIq2n5TpE2NcNkz4n+ZktEZsD4RzMSifFMfh96a PxC9sN2ThmWvBHAwlUq5T28kWV5D12dk2wXzC0h9uQjfUQokgPBKRZHMXiAX+sVn81uo jjnuiIywKHwimRXAcYHf28AnCIouhPLIspS8eTA9YNaN1TMkz66AqxghyUTBL8yi94mt lVhwYvFN53jwTOOa8Y4UKQ/vYyfH85bNTaYFqqfWYlyqgYx2lh0O9tvCWV569ur4AexR y0tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697822135; x=1698426935; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hxDbAKxZshnw2aCKoDntFb9lK0/E0E536iU7q/e3O4Q=; b=ldsMMsxetCLCHC7zIq+E1JgWLQluL/oF//3t5ATzkGj+9SsTuWUyDnBjKV+DcRTpdj dzoVKxCuRvhQHjl17WACLxBnLpY4J9gw9OAMVKaboRLxVhXVUoHFogr+TfTAo2IFH25c ZLrB5N7ZbHVF43PvGQghdLHpSogfxrcEwZabJvdj65qX83zBnpDOMlCw8ivYs1sd744x fHBXJp/OxEtUL2Jat7oRCfy0tblAc+FwRHfKszzt+WpOo6hEYWacqB4UB7wLWY8RJpFT QKylo9Xe+eexcpvFA3APC1fqiKtDov727Qykg3jV6EnQbdYLa+bKVLuNIw92FJ8eJczf noWA== X-Gm-Message-State: AOJu0YyKwwOLuYMdSHk/z4Xufs4mX/Qm68fTjGzRLD47VS8maYA4j64m V6M5BNVIeOi5z7BVj0eQuSf4B1d1+0bj2Ivk3vc= X-Received: by 2002:a19:5051:0:b0:507:b084:d6bb with SMTP id z17-20020a195051000000b00507b084d6bbmr1717277lfj.43.1697822135285; Fri, 20 Oct 2023 10:15:35 -0700 (PDT) Received: from m1x-phil.lan (tbo33-h01-176-171-212-97.dsl.sta.abo.bbox.fr. [176.171.212.97]) by smtp.gmail.com with ESMTPSA id p7-20020a5d4587000000b0032db430fb9bsm2072239wrq.68.2023.10.20.10.15.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Oct 2023 10:15:34 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , "Michael S. Tsirkin" , Richard Henderson , Markus Armbruster , Bernhard Beschow , qemu-ppc@nongnu.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Paolo Bonzini , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v4 4/4] hw/isa/i82378: Propagate error if PC_SPEAKER device creation failed Date: Fri, 20 Oct 2023 19:15:08 +0200 Message-ID: <20231020171509.87839-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231020171509.87839-1-philmd@linaro.org> References: <20231020171509.87839-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::135; envelope-from=philmd@linaro.org; helo=mail-lf1-x135.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org In commit 40f8214fcd ("hw/audio/pcspk: Inline pcspk_init()") we neglected to give a change to the caller to handle failed device creation cleanly. Respect the caller API contract and propagate the error if creating the PC_SPEAKER device ever failed. This avoid yet another bad API use to be taken as example and copy / pasted all over the code base. Reported-by: Bernhard Beschow Suggested-by: Markus Armbruster Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Bernhard Beschow --- hw/isa/i82378.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c index 79ffbb52a0..203b92c264 100644 --- a/hw/isa/i82378.c +++ b/hw/isa/i82378.c @@ -105,7 +105,9 @@ static void i82378_realize(PCIDevice *pci, Error **errp) /* speaker */ pcspk = isa_new(TYPE_PC_SPEAKER); object_property_set_link(OBJECT(pcspk), "pit", OBJECT(pit), &error_fatal); - isa_realize_and_unref(pcspk, isabus, &error_fatal); + if (!isa_realize_and_unref(pcspk, isabus, errp)) { + return; + } /* 2 82C37 (dma) */ isa_create_simple(isabus, "i82374");