From patchwork Tue Sep 3 15:36:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 172814 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp19991ily; Tue, 3 Sep 2019 08:42:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqzRT1i0FpfkBnrOH0bNqkNEwMOAA6lpojOysLDofXnJ1zwwIZfUcjftg99D1P+M2gDOj0VH X-Received: by 2002:a50:d6db:: with SMTP id l27mr14488274edj.164.1567525321968; Tue, 03 Sep 2019 08:42:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567525321; cv=none; d=google.com; s=arc-20160816; b=zcHq5PMhKNjatKpwmta2AtumEoEgNMCcIbC4iV3BlLusYg0NimLSoIbFCEm9AksMO5 f3mWB5XtIQwWD17qm1pxOMHuzcarBtM48eoWsyCssfX/H6VbhvwwrBKynvHSfqdF3JC6 cR61QTMO47a8IvgNeprkPKsAvNoVIZ4r05opclvVTbtkuWoIxTsP0D7F4g0/mbzEcIOn zNgrEfNOBX9I+3p3iuVZb4yYTnWzFllSJf/ZO6mruQLU7KuLfonglkTswmg4pIsUz228 zqJSaooHJDhhI8NrtecrONI9ECJeBg27KS1qigZWvykUSWZFvta9tgRWdE5sId4xL6Zh TvSQ== 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:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=Jh428xFMZspE9pzmT4T/vs6lA+3UmLCdDqsT/xMT5PA=; b=VFw4hu0TRYM/cGMqniFkQ20eiOr6m2TtCiPI2zXgk8XnEk9ankRvr85+6eoK/735IS 2MqIPfUwX03yAIudb40hLpfDHKU6+QZUGOS0UKzYQNkHRmgD1VrKGXTU/VfhOP5ftO0Q vYJA+0z4sILZx+aG3swGWGEZXs5u5+gQjXw38ZsUdH/DrSVvQdUy+RVFeQ85lU+leTRn qXNVuEg1KWY3jSDNKTkUAFe1NO2KsLGATpxzzhRsYOkWnjgv6yt6tIbDMVJYaZlC/byJ EbPqvC3PXtEa4Xnimc/qav4gxD6BKnmWT8TWLLsxitDyLquGHdsRm+wZrhZnY6ERqQ5d ceBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=rPK2hf4T; 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=fail (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 b27si4809567eje.123.2019.09.03.08.42.01 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Sep 2019 08:42:01 -0700 (PDT) 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=fail header.i=@linaro.org header.s=google header.b=rPK2hf4T; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5AwS-0007yn-Ar for patch@linaro.org; Tue, 03 Sep 2019 11:42:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59294) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5ArW-0002yB-Hy for qemu-devel@nongnu.org; Tue, 03 Sep 2019 11:36:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5ArV-00060q-CY for qemu-devel@nongnu.org; Tue, 03 Sep 2019 11:36:54 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:53089) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5ArV-00060F-6C for qemu-devel@nongnu.org; Tue, 03 Sep 2019 11:36:53 -0400 Received: by mail-wm1-x329.google.com with SMTP id t17so18753650wmi.2 for ; Tue, 03 Sep 2019 08:36:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Jh428xFMZspE9pzmT4T/vs6lA+3UmLCdDqsT/xMT5PA=; b=rPK2hf4Tm3a3xnzX1tqtxXub5x15pPJcI11sH/pYEdjJd7Vy+LC5W4UsULfAUXDnMD G60b3LkNc7BxVSKh2wjvodE/SxtrWKQhWuyGChggHeundz6Zhkv555z0VDhAgviIjzSY DYgjsNFXUYpomxw1k1zXyySCTj01a9XGQ5j9WqqEYTfQRYqh0FkwT0rsKmaF6gIVXqW5 /5Zp4/1G1BO/q6vz2BWnxbzL64E3xCvOyyhoKDUJwPzbt0A/61+lsNQxfWadS5P7qMZd 6g/3sB31q74KZft20MC/cxOCiBoZIuZUtO3XErk/v2xjspGEqs+k1KEY3dlpIGG4lmgV mZPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Jh428xFMZspE9pzmT4T/vs6lA+3UmLCdDqsT/xMT5PA=; b=p5VEyZiz7aoHEgMYLuNYtcv702FQIuiVZAEmDqdnw5mecESQbkYfsxNUOtHaPV9Zwi 7mc1ff1y+0suyy3ItHV/tNcCmYlpVLBSUFzjzqagwYrkNW1hu7bBR2C2WuaGQ2dJMjKf iTMniYzfgti4yQ78j+P2AeDRsEAkPPCLyZzVQTKYjXxA7EjxwIfaXQDnYO8iBkhflmEE yT04S5/HtGyASC9Q6OiF05FDSmmtKBwvzAmQHzOT1n1IQBi6K/h7/RWVjJOxAXBFYEsA 0eBwgF2EJdmgC1/OE79CmbaTgfiL/32s12Fp7XjumOK/dA76sQBS/KzaF/OzbnxxsYWl 2NNw== X-Gm-Message-State: APjAAAXsO08f4iuQaAyBOakIkveWDvNTU6vJA6bubhSRbpDjnfAUHUc/ Edh4Qq5e6w+5k2JAGDW1aSMDYqq895Vlbw== X-Received: by 2002:a7b:cb0f:: with SMTP id u15mr717576wmj.173.1567525011888; Tue, 03 Sep 2019 08:36:51 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id a18sm24435188wrt.18.2019.09.03.08.36.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2019 08:36:51 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 3 Sep 2019 16:36:26 +0100 Message-Id: <20190903153633.6651-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190903153633.6651-1-peter.maydell@linaro.org> References: <20190903153633.6651-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::329 Subject: [Qemu-devel] [PULL 14/21] hw/dma/xilinx_axi: Use object_initialize_child for correct ref. counting 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé As explained in commit aff39be0ed97: Both functions, object_initialize() and object_property_add_child() increase the reference counter of the new object, so one of the references has to be dropped afterwards to get the reference counting right. Otherwise the child object will not be properly cleaned up when the parent gets destroyed. Thus let's use now object_initialize_child() instead to get the reference counting here right. Reviewed-by: Alistair Francis Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Reviewed-by: Richard Henderson Message-id: 20190823143249.8096-6-philmd@redhat.com Signed-off-by: Peter Maydell --- hw/dma/xilinx_axidma.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) -- 2.20.1 diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c index d176df6d449..a254275b64e 100644 --- a/hw/dma/xilinx_axidma.c +++ b/hw/dma/xilinx_axidma.c @@ -566,14 +566,14 @@ static void xilinx_axidma_init(Object *obj) XilinxAXIDMA *s = XILINX_AXI_DMA(obj); SysBusDevice *sbd = SYS_BUS_DEVICE(obj); - object_initialize(&s->rx_data_dev, sizeof(s->rx_data_dev), - TYPE_XILINX_AXI_DMA_DATA_STREAM); - object_initialize(&s->rx_control_dev, sizeof(s->rx_control_dev), - TYPE_XILINX_AXI_DMA_CONTROL_STREAM); - object_property_add_child(OBJECT(s), "axistream-connected-target", - (Object *)&s->rx_data_dev, &error_abort); - object_property_add_child(OBJECT(s), "axistream-control-connected-target", - (Object *)&s->rx_control_dev, &error_abort); + object_initialize_child(OBJECT(s), "axistream-connected-target", + &s->rx_data_dev, sizeof(s->rx_data_dev), + TYPE_XILINX_AXI_DMA_DATA_STREAM, &error_abort, + NULL); + object_initialize_child(OBJECT(s), "axistream-control-connected-target", + &s->rx_control_dev, sizeof(s->rx_control_dev), + TYPE_XILINX_AXI_DMA_CONTROL_STREAM, &error_abort, + NULL); sysbus_init_irq(sbd, &s->streams[0].irq); sysbus_init_irq(sbd, &s->streams[1].irq);