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 */