From nobody Mon Feb 9 09:16:17 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1629390877; cv=none; d=zohomail.com; s=zohoarc; b=fh90E3jX4ZvgevfX7y6XQ9CcwRTaorN9djdX8KqkQVaMVjj8BpyOQOd7nXr6BQ5pkc8wybfMX7kS6a7c2WpZKYqLIo4OnvAmJhrE8beI3OmvsCKjsYGXrSFPDcqqFA5reBmlrKfjONAo6AFxUkhwsUmWzt98isqINYxISRoKVYU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629390877; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=b1BcV5WiBp8LKmmxTl7tfHXLESegIF/jg2cb6jvljSI=; b=LJB01dM81mTF07hzp1nDWEuGuo+foxv/3wsZgIQOARPLLr2qi9M+wgahb1Keyow6NWuB5KFIeK8QXakv4gZT7R5IDw0BW+h4pqrc0OfGre7O0IdGgrFwjDoYQ9nBO/FsF2OOBB4XvE/cQiStRBD5q33j7Lq3Bt2DpgaZwTxGqZ4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1629390877476302.93318051954486; Thu, 19 Aug 2021 09:34:37 -0700 (PDT) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-542-iC2hkR5BMsCk9bi-YigtBQ-1; Thu, 19 Aug 2021 12:34:35 -0400 Received: by mail-wm1-f69.google.com with SMTP id b196-20020a1c80cd0000b02902e677003785so3679150wmd.7 for ; Thu, 19 Aug 2021 09:34:34 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (163.red-83-52-55.dynamicip.rima-tde.net. [83.52.55.163]) by smtp.gmail.com with ESMTPSA id o10sm3316911wrq.51.2021.08.19.09.34.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 09:34:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629390876; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b1BcV5WiBp8LKmmxTl7tfHXLESegIF/jg2cb6jvljSI=; b=eArMVfWEfQYqAi7b7OT6B+k9tkJBpgC+Q5YEevfrWDDlyq8PMFMyQcjrZp2sRYRORIht9N 0Bi9C51NxhZyNSQ+hq7KK4lpm6nj+AVS3VTpL0/Rt/RDEGnhgzrXwE/ZwD1Kb6BjYiVI/w jQesQVUgpy/R3dR6g7GYq669ao5yedw= X-MC-Unique: iC2hkR5BMsCk9bi-YigtBQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=b1BcV5WiBp8LKmmxTl7tfHXLESegIF/jg2cb6jvljSI=; b=t95A5+LzpQ8rbV9ZK3YsBMPTqMa7PD9/8YRVcHnmrpaDisCZkIv2dYd7c+z/0qVjG9 3Ccp8T/VLUeVp5paeiRIpGgKbiLHCASQ8mwfi5R0RnK7giLQYoaZPWeucxaITnLMozv6 LyL8Gv9m4QrskCUxRynQ50dL/FWw5pbBUWBfqXxKTs37OW9iYvthH6NCq32QSRAWECGs 1ir3p9SNs1WVdodl8nXcprjqtRTalu+6MoxrJBEjIonoYGMhF3371Lv2BWfL+fcyImJu rnGjs2lkI8D6vcQoTk05whETT4/ILCdiZuLj/0wdqX0FRZLfeEaQ87AWTSzroju0jfC6 ZzCw== X-Gm-Message-State: AOAM531klEvc/QiKcfJTAGghP5Np0cjPFKUCr3eFfWZNkVNlo9arbnDH 4nKrlngJ07SSLPtfU4B765hKkW2in+dHRjvuY8McdtBJDjHRvk7jAzZNnjKnJDbTS1J+SyjlBsY gzUQ75qZti0Xehw== X-Received: by 2002:adf:a3c6:: with SMTP id m6mr4852196wrb.32.1629390873922; Thu, 19 Aug 2021 09:34:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAp9Aue44zgaObYaItnGDCL+p5AUvxyiRGrLr2qY4HusiLTcG2fL/Ee3HcZTMJnUL7aBvEGg== X-Received: by 2002:adf:a3c6:: with SMTP id m6mr4852182wrb.32.1629390873808; Thu, 19 Aug 2021 09:34:33 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, Alistair Francis , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 2/4] hw/dma/xlnx_csu_dma: Run trivial checks early in realize() Date: Thu, 19 Aug 2021 18:34:20 +0200 Message-Id: <20210819163422.2863447-3-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210819163422.2863447-1-philmd@redhat.com> References: <20210819163422.2863447-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1629390879153100001 If some property are not set, we'll return indicating a failure, so it is pointless to allocate / initialize some fields too early. Move the trivial checks earlier in realize(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alistair Francis --- hw/dma/xlnx_csu_dma.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/dma/xlnx_csu_dma.c b/hw/dma/xlnx_csu_dma.c index 797b4fed8f5..2d19f415ef3 100644 --- a/hw/dma/xlnx_csu_dma.c +++ b/hw/dma/xlnx_csu_dma.c @@ -626,6 +626,11 @@ static void xlnx_csu_dma_realize(DeviceState *dev, Err= or **errp) XlnxCSUDMA *s =3D XLNX_CSU_DMA(dev); RegisterInfoArray *reg_array; =20 + if (!s->is_dst && !s->tx_dev) { + error_setg(errp, "zynqmp.csu-dma: Stream not connected"); + return; + } + reg_array =3D register_init_block32(dev, xlnx_csu_dma_regs_info[!!s->is_dst], XLNX_CSU_DMA_R_MAX, @@ -640,11 +645,6 @@ static void xlnx_csu_dma_realize(DeviceState *dev, Err= or **errp) sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem); sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq); =20 - if (!s->is_dst && !s->tx_dev) { - error_setg(errp, "zynqmp.csu-dma: Stream not connected"); - return; - } - s->src_timer =3D ptimer_init(xlnx_csu_dma_src_timeout_hit, s, PTIMER_POLICY_DEFAULT); =20 --=20 2.31.1