From nobody Wed Oct 29 17:31:56 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1524821843942936.9139224397707; Fri, 27 Apr 2018 02:37:23 -0700 (PDT) Received: from localhost ([::1]:46757 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fBzoh-000779-3O for importer@patchew.org; Fri, 27 Apr 2018 05:37:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59435) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fBza6-0001hT-6p for qemu-devel@nongnu.org; Fri, 27 Apr 2018 05:22:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fBza5-00025t-7s for qemu-devel@nongnu.org; Fri, 27 Apr 2018 05:22:18 -0400 Received: from ozlabs.org ([203.11.71.1]:48447) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fBza4-00024T-R9; Fri, 27 Apr 2018 05:22:17 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 40XT2q3wHgz9s78; Fri, 27 Apr 2018 19:21:35 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1524820899; bh=nIgI4e+qlDd8IkApMARoic4jah5OB7VAMJUUe47+qYY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gm0/LI3xBIhGuTRNOcGISSB9hzCk33e1cS5Yy1YEADrEfHA6Efsde3K78Sus7jiWd 8egFMJjV6rPS0p1xcXtfQ0QaZnmVbreVsabJqFaJfbQHU9Z2K68phtxVX00QjrPmKO zlpljndJapCsT0Q4KgDtNpn3QL5A4nYzdeIVV3ig= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 27 Apr 2018 19:21:05 +1000 Message-Id: <20180427092126.24812-29-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180427092126.24812-1-david@gibson.dropbear.id.au> References: <20180427092126.24812-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 28/49] spapr: drop useless sanity check in spapr_irq_alloc*() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Greg Kurz Both spapr_irq_alloc() and spapr_irq_alloc_block() have an errp parameter, but they don't use it if XICS hasn't been initialized yet. This is doubly wrong: - all callers do pass a non-null Error **, ie, they expect an error to be propagated in case of failure - XICS obviously needs to be initialized before anything starts allocating IRQs So this patch turns the check into an assert. Signed-off-by: Greg Kurz Signed-off-by: David Gibson --- hw/ppc/spapr.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index b92dad2273..5a1c1e25e1 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3719,9 +3719,8 @@ int spapr_irq_alloc(sPAPRMachineState *spapr, int irq= _hint, bool lsi, ICSState *ics =3D spapr->ics; int irq; =20 - if (!ics) { - return -1; - } + assert(ics); + if (irq_hint) { if (!ICS_IRQ_FREE(ics, irq_hint - ics->offset)) { error_setg(errp, "can't allocate IRQ %d: already in use", irq_= hint); @@ -3753,9 +3752,7 @@ int spapr_irq_alloc_block(sPAPRMachineState *spapr, i= nt num, bool lsi, ICSState *ics =3D spapr->ics; int i, first =3D -1; =20 - if (!ics) { - return -1; - } + assert(ics); =20 /* * MSIMesage::data is used for storing VIRQ so --=20 2.14.3