From patchwork Fri Sep 11 19:33:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1362657 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bp5by5QCYz9ryj for ; Sat, 12 Sep 2020 05:36:46 +1000 (AEST) Received: from localhost ([::1]:53162 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kGoqi-0006dO-LC for incoming@patchwork.ozlabs.org; Fri, 11 Sep 2020 15:36:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44700) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kGonn-0002Zk-1h; Fri, 11 Sep 2020 15:33:43 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:33945) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kGonj-0000ne-Sh; Fri, 11 Sep 2020 15:33:42 -0400 Received: from localhost.localdomain ([82.252.129.222]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MyNoa-1kShwq1D2q-00yhVm; Fri, 11 Sep 2020 21:33:36 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 02/18] hw/isa/isa-bus: Replace hw_error() by assert() Date: Fri, 11 Sep 2020 21:33:14 +0200 Message-Id: <20200911193330.1148942-3-laurent@vivier.eu> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200911193330.1148942-1-laurent@vivier.eu> References: <20200911193330.1148942-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:T5tDDC6sn8sfomspzaRG6piVUoCJq/6+OY5a/NPxdgYZBZQMAQp 4elPTyTwbRZw55Gpo1Ub6lkDCTWmxhQvWaveUsCC6z7Nd+XXS+2iCZHTQq+YFgjD5UP4bS2 WgvrN9GJr/kDObO+EDeY4AtpRDTMZwJEVcUZP2wcC6YAEUfAZ/W+zmxLXPjVsO/ip4nSBFp SF4P5VOkc+2pB6TVc7caw== X-UI-Out-Filterresults: notjunk:1;V03:K0:7QDBlccRhQM=:lo18sON3JHGEEOcvvUxGa0 87rpIorodcFlGL4dePZQMIR8vGmWF8oC2vEzwbEk+T+wVcnqHXm07aQrMCamlx4dONwuZaTqf Hoqds7Ztrjl3NOXG/YtiW2EO0AFOo9RuqRNwn1yzzOLcFhyw17kz4TWcx/OFl7yhn4Vq+Ju4t lxQGUSX/C58CY13IM5ATeSe8vR7YFLjY0IWnEEvZueX6/n27cHNqjNUtadW0C2AthGXMcGlTB U/vb22suJoAfflKGdSFXhBGZ1jKSNNts7hlgEQRZUHA9IudSYKIG76o5wa1e9qIXfknV5Dzqj kJ3dlkbf7U20YMTHozp7NoxiLiMGwMUJ7cyMcuO4DNmeVpCU3UvaGj//HzoefRT5Ap2wJBmXM 2v/7m7EG4wsUFSX5NguULUXfYzhSPqwGxs3sYdOK+ESl2xnIMXthoaM10eb8yiwX2hEhZQMCU 25Pod5+mnbkTRqrA9UKLhnNJAaEVkZKpo7gzMA0ITBYgF9WAYA+VmgRGt1K8NSX9wmW1TE6LK GJW/hCXFotSB5sMpTr4dKNyBUBXygyNRjAdd4Civ10VfbQ7WHEzuot/oPgJDkRD+A/qQ2yUFn 4zZ19rjY5FEryEljZOxyo1IrR23HJAQrJSg1qdrUP1Xbnt0OcVq3WgBs1oqVKP/d1BTs3jLpc 0Ov92a/aE6YfVjNtUXH1YK3deR71RadX1MFVslBBPscKtQtmuGZpAImyIz2h6B7z16/DFoey8 xQrB1N/MtqCn7KvqRTcejE23dB1vlYxR5/XP5fo8upgd8zEE7ktC4dnn/mggtdyAqR9VHgJ7h jNLgaSHZyokKmQbL6V63Itd5OX6yXgTvMTbwtUvklxXbx2rewgp2vSDpRNMMB+VH8ROxU2R Received-SPF: none client-ip=212.227.126.134; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/11 15:33:38 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, Richard Henderson , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé As we can never have more than ISA_NUM_IRQS (16) ISA IRQs, replace the not very interesting hw_error() call by an assert() which is more useful to debug condition that can not happen. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20200901104043.91383-6-f4bug@amsat.org> Signed-off-by: Laurent Vivier --- hw/isa/isa-bus.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index 58fde178f92a..10bb7ffa43ae 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -21,7 +21,6 @@ #include "qemu/error-report.h" #include "qemu/module.h" #include "qapi/error.h" -#include "hw/hw.h" #include "monitor/monitor.h" #include "hw/sysbus.h" #include "sysemu/sysemu.h" @@ -85,18 +84,14 @@ void isa_bus_irqs(ISABus *bus, qemu_irq *irqs) qemu_irq isa_get_irq(ISADevice *dev, unsigned isairq) { assert(!dev || ISA_BUS(qdev_get_parent_bus(DEVICE(dev))) == isabus); - if (isairq >= ISA_NUM_IRQS) { - hw_error("isa irq %d invalid", isairq); - } + assert(isairq < ISA_NUM_IRQS); return isabus->irqs[isairq]; } void isa_init_irq(ISADevice *dev, qemu_irq *p, unsigned isairq) { assert(dev->nirqs < ARRAY_SIZE(dev->isairq)); - if (isairq >= ISA_NUM_IRQS) { - hw_error("isa irq %d invalid", isairq); - } + assert(isairq < ISA_NUM_IRQS); dev->isairq[dev->nirqs] = isairq; *p = isa_get_irq(dev, isairq); dev->nirqs++;