From patchwork Mon Feb 13 10:10:42 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: 653191 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2325636wrr; Mon, 13 Feb 2023 02:11:39 -0800 (PST) X-Google-Smtp-Source: AK7set9z7KT1YdsS/qUFctdkZeS59YTlPI3lnGwtcbmg+cvZVgoVaDI1vaDX7DfZkD1jm96dfohl X-Received: by 2002:a05:6214:27e1:b0:56e:a9d4:428a with SMTP id jt1-20020a05621427e100b0056ea9d4428amr6561319qvb.1.1676283099719; Mon, 13 Feb 2023 02:11:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676283099; cv=none; d=google.com; s=arc-20160816; b=MFCrgXJtOaiFsH9Ot+II+w/1yiEa+J6qGPEnALcMsVN2Zcti2/bo8HiUkBd4imhqBe v8w6OG25DdixQ/8B9HoJa6nP2o8Is3pBOhtyiDbm4LegHMhOZNqqi+Rkgv71XXjRKQWl aiTOec0U+ykIazTgo9hfPPhhQLyVRMbNXLz/15leX8raJX9s2vOjlAc01yrpc8Divgxj dARjRSG3keQKszXlG0pTfaVkn+wb2lBu5xLFJjkjaE1r8rupdeC7W4Pi7OcJ50r5bk9V gyBCoNJzqRGWECI3FnbQvMpJHt2aFboiv0bBy5tgt1O+3UapDTwptOZ6hexr9WDBc5VW s8aQ== 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=s4DvDo0UQW2wHHaZyEw/ZO2I4PAch3e8r1jmccdccY0=; b=0vf46u3mN6+nvSz/hLw5OV7tU5X4R0AiWnO7DoqP+jKHND7rKOnJvuVdxHHdimmcuu WAveht4b8dOroTj28P8ARcYFjOjjndbKDk4Q7Cd/lxm30+InpY3hRPyMuUtKyE303Rh+ PCfSfeXLrIc/1FEZHw0gnxW7sMotZpBj/9b9RLbLwQBqIqArJv1q4qL0qV9VWSXALwmV q3sL9ztWFafC+fkRZMmW3BagOAbTOV4jx78WPklKAwYE+K5kltBmIGYBP3Is2TUf5DBi jBZSEKSsrmlPq/0Cxd8pBJC6gUzQDJF+4xu4yiuNsMArHBqnnGLdUuYDB6yrh4/p1wAg 1htA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Vetiidoy; 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 d4-20020a0cf0c4000000b0056e93b6d99asi2569585qvl.77.2023.02.13.02.11.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 02:11:39 -0800 (PST) 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=Vetiidoy; 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 1pRVnX-0005Df-TO; Mon, 13 Feb 2023 05:10:59 -0500 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 1pRVnW-0005DW-VZ for qemu-devel@nongnu.org; Mon, 13 Feb 2023 05:10:59 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRVnV-0003OT-Bo for qemu-devel@nongnu.org; Mon, 13 Feb 2023 05:10:58 -0500 Received: by mail-wm1-x336.google.com with SMTP id c4-20020a1c3504000000b003d9e2f72093so10868042wma.1 for ; Mon, 13 Feb 2023 02:10:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=s4DvDo0UQW2wHHaZyEw/ZO2I4PAch3e8r1jmccdccY0=; b=Vetiidoy994cgLQd8Tg0t/nVbIAPuAnoxmD5wLDLCSNAIhULpFJTVf6VNm+QCBg4VO yVjhNPBqqqxD2Uy+9/CtFExcLTOoRT1bw6ib3cThuRto4Tvx1cRKjJgpNzO4tWrgH+VC L6IpwRSEVIpdkeMzjOjf6R7fZ2YNp9Kw6mp1TtXIror4vNAiWfFJ1TVhhd8lUPvzAM4+ oDYMYti+tSLLFrV3aKBoIyo8Q44q5PDvT0WrgiVvq/bnIt1jkZ5PYrwbdGKR8/dh8MH3 W3RRw1ctXM095PmUIC2xsOAPSsNtxVMUNsPL997ZTG85fG3HuXPtILNu5ElakMSchJbs zFkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=s4DvDo0UQW2wHHaZyEw/ZO2I4PAch3e8r1jmccdccY0=; b=T9gr+Dzz1A7D6WCn7vg8ri93yUBPsPX5BsZeA+NDQIuXzZA8c/cluNVO1oY5sqGIRn iI+xkIi20zeoG+m3kPF6ts4WelMOrOqJmBwHfr/Ch0itbQUl90yK3WUua3AvJq47W7rI eDAzR+oMR6o//BSjTUz1pyHyH6lr9DplvnWjT+1Vx5Lbfbp9qOMKBormAL4cr7mv/5Dl Hy0Ey5oyl3ARbirDEWno8B6b3y0vqjHIMbVCoiMSjTVzmi9iJ8MdZARoVG+9hcJOBbXE BBg2Dpt1xQ1WkbfY76wHBJsReOEfz1fpQDKH6G9gLUR1uOEQytJIzXCd5PTEyXpRDgKg PGAg== X-Gm-Message-State: AO0yUKV38DeivAOgNVgrF3SlJ1QpSVn9uYPP5CFC2gcO0YguoLwph8KR ps6K2fqGDowtFexFvVBahkZcYNpuWst/+9vg X-Received: by 2002:a05:600c:329d:b0:3dd:97d6:8f2e with SMTP id t29-20020a05600c329d00b003dd97d68f2emr17865001wmp.17.1676283055385; Mon, 13 Feb 2023 02:10:55 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id j20-20020a05600c191400b003dd8feea827sm18304989wmq.4.2023.02.13.02.10.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 02:10:55 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: Jason Wang , Thomas Huth , Igor Mammedov , Stefan Weil , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 1/7] hw/net/eepro100: Abort if pci_add_capability() ever fail Date: Mon, 13 Feb 2023 11:10:42 +0100 Message-Id: <20230213101048.94519-2-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230213101048.94519-1-philmd@linaro.org> References: <20230213101048.94519-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.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 If pci_add_capability() ever fail, the EEPRO100 device is broken, which is a bug. No need to report that to the user, abort instead. Signed-off-by: Philippe Mathieu-Daudé --- hw/net/eepro100.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c index dc07984ae9..dce75039ec 100644 --- a/hw/net/eepro100.c +++ b/hw/net/eepro100.c @@ -549,13 +549,8 @@ static void e100_pci_reset(EEPRO100State *s, Error **errp) if (info->power_management) { /* Power Management Capabilities */ int cfg_offset = 0xdc; - int r = pci_add_capability(&s->dev, PCI_CAP_ID_PM, - cfg_offset, PCI_PM_SIZEOF, - errp); - if (r < 0) { - return; - } - + pci_add_capability(&s->dev, PCI_CAP_ID_PM, cfg_offset, PCI_PM_SIZEOF, + &error_abort); pci_set_word(pci_conf + cfg_offset + PCI_PM_PMC, 0x7e21); #if 0 /* TODO: replace dummy code for power management emulation. */ /* TODO: Power Management Control / Status. */