From patchwork Thu Mar 2 22:40:50 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: 658167 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp145446wrb; Thu, 2 Mar 2023 14:44:01 -0800 (PST) X-Google-Smtp-Source: AK7set+nV5SyBBsoTrsItMFWlFwyk36dR/tHUE0a3papcPbssxxkxH2SuT39VwFmcEzfF4l0IBxO X-Received: by 2002:ac8:5805:0:b0:3bf:a932:5bce with SMTP id g5-20020ac85805000000b003bfa9325bcemr5783697qtg.2.1677797041203; Thu, 02 Mar 2023 14:44:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677797041; cv=none; d=google.com; s=arc-20160816; b=fv4ONLj0SbSt1CQZQDwf9eP+6WCaHPQD3C5Gfcwq51lAoYJfaT6jhMRdyB6t0iDQdT qbd0rcQV33dBhtYQQnMpByX1VzKXKnEHgd2mhAn48A/yN45pINRzoOCN00I28wFU0IPX 47pB9c0KBunctX1kkp6P3BL8cm2x3ARxvUjeICauphtCn7bMjGoF+1P6sRWUdUslq68o g4p4U85GIEJvZdUYbfpKUZQ83zR5KN3jQetGzqE7gDFo6zzwhiFebV2jkT7eczJW3del oOnymEd/pLFccKpmdqSNmGfy17mA9N+B0rUDbfNsFATLZbtI3KarTu5RvYPx2O9RvkOM 8UMA== 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=uZKWKOH8CoWlg9l+QWicKQtR++JaD+yXwzgRvDSnsXc=; b=DwU1RT3Jan9dzvQfqsV1Tdq8pGq31Q4nmQt/U2KqeXpaZ4mE1F5NWBNcvmBeQAOqZj EeyM4wI+dEcuKn1snymVfgLEEdjxUYpsC7t/PYLd7bZjno8/Xrj6RzE35XKuZC72aJVt crjE5I0FwBHjL4e0ZQxLjm7wKCKMieLzhLOdA87myPIXUnrccDz3nYUjnrpNUPW3lF0x QdTy+KlQS5Y8rxy2aG1QdVi6MjDRXOjkxZyIYOAisCk5JtYjMpsz4t0gfTw2R3KCxqCg V5xCHrhDxsa1N7cMQkhdsbt4yfdNbrQDcWmVKjRWI2l+7dTHleg7+/h4JRU1sCNAYlWq gOQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E2opBkC2; 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 d15-20020a05622a05cf00b003b637d3f3e5si545788qtb.402.2023.03.02.14.44.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Mar 2023 14:44:01 -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=E2opBkC2; 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 1pXrcy-00087U-R9; Thu, 02 Mar 2023 17:42:20 -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 1pXrcx-00085f-Nw for qemu-devel@nongnu.org; Thu, 02 Mar 2023 17:42:19 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pXrcw-00008u-6Q for qemu-devel@nongnu.org; Thu, 02 Mar 2023 17:42:19 -0500 Received: by mail-wr1-x432.google.com with SMTP id f11so589859wrv.8 for ; Thu, 02 Mar 2023 14:42:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677796936; 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=uZKWKOH8CoWlg9l+QWicKQtR++JaD+yXwzgRvDSnsXc=; b=E2opBkC2OPOkkNFS0K7TUoEqmxa19CAMemYoqOFRucWvymzrZmWHHBj/pwQ9GNniCY 93vB2w42/Rjoz5neMjSmBgGFeixhfjIsWQ9WBsVJXQTEsqn1Zr8OV9zJOT/ubHW/rE/A cYGODGRzESDdXDO426XHvOVNSm6gFXjpHmvP0E6rX1PHofLomAwGMgkkv1PodA0uvIJN TOtYoT4PPYp14zYwGgZF1OTaf2qYogmoFT95ZttuKA+a5Bx7/HSU6tA/vkUGeZ57KWeH 5yhNatwUF1wjya/8DJn3MnL6/L8rdzICrKVRrBSlmShmk3M4aiOijm3Cif8Vi9YpwcF0 87zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677796936; 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=uZKWKOH8CoWlg9l+QWicKQtR++JaD+yXwzgRvDSnsXc=; b=YQXDtLgWSLKLUSGn8jvZn7zBxk1YfG4izx6CCghHgucrPskKfT3AjEO3zDNPZQRJib BvMwnXxrXOjH/U1fTCWAThuguFWPwD6iJrtOhJLK9awzpuLsAm+C946d6fwu6jdqhwbb CbAJdqHxWm/47+8e3eUhQccWHW3RQ/VSRfQyL//3olqjy/xxlKZhUvzERXt03ocOnoaG Cv2pCvaiO1XAGlGGpuwzPCWP9xPsOCddbvQUdytfrUOr22pRBvU9TVvpr8hYGVAbBgoY WDEKQ5A+XIHRUA/mw9tR6TNh35mAY8k7nnJYBwRUBXDgRGfNGgGE8DfBvn1yoPoxFTuX zhCQ== X-Gm-Message-State: AO0yUKVdHXXSsOOWQsgSWOVNSC4Cy5YAvBBMViNM8D0jFO2B/+fzoobH ROYCdQgncH4KRZmF9t2XyC4jeFjPmeK8YK9u X-Received: by 2002:a5d:6084:0:b0:2ca:e856:5a4 with SMTP id w4-20020a5d6084000000b002cae85605a4mr2581542wrt.26.1677796936316; Thu, 02 Mar 2023 14:42:16 -0800 (PST) Received: from localhost.localdomain (43.red-95-127-39.staticip.rima-tde.net. [95.127.39.43]) by smtp.gmail.com with ESMTPSA id j2-20020a5d6042000000b002c70d269b4esm464219wrt.91.2023.03.02.14.42.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 Mar 2023 14:42:15 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Bernhard Beschow Cc: John Snow , David Woodhouse , BALATON Zoltan , =?utf-8?q?Herv=C3=A9_Poussineau?= , qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 10/18] hw/isa: Ensure isa_register_portio_list() do not get NULL ISA device Date: Thu, 2 Mar 2023 23:40:50 +0100 Message-Id: <20230302224058.43315-11-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230302224058.43315-1-philmd@linaro.org> References: <20230302224058.43315-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.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 Previous commit removed the single call to isa_register_portio_list() with dev=NULL. To be sure we won't reintroduce such weird (ab)use, assert dev is non-NULL. We can now calls isa_address_space_io() to get the device I/O region. Note we can then remove the NULL check in isa_init_ioport() because it is only called in 2 places (and is static to this file): - isa_register_ioport() which first calls isa_address_space_io(), itself asserting dev is not NULL. - isa_register_portio_list() which also asserts dev is not NULL since the previous commit. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Mark Cave-Ayland --- hw/isa/isa-bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index 081bac18ee..9c8224afa5 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -113,7 +113,7 @@ IsaDma *isa_bus_get_dma(ISABus *bus, int nchan) static inline void isa_init_ioport(ISADevice *dev, uint16_t ioport) { - if (dev && (dev->ioport_id == 0 || ioport < dev->ioport_id)) { + if (dev->ioport_id == 0 || ioport < dev->ioport_id) { dev->ioport_id = ioport; } } @@ -129,6 +129,7 @@ int isa_register_portio_list(ISADevice *dev, const MemoryRegionPortio *pio_start, void *opaque, const char *name) { + assert(dev); assert(piolist && !piolist->owner); if (!isabus) {