From patchwork Tue Sep 3 15:36:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 172817 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp24815ily; Tue, 3 Sep 2019 08:46:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxMdDidqPMzwnXcYOGH50pYTLfx1f35MIWCxnS8n2YobfQPiwxvgGHSowJStrqS9I24KOti X-Received: by 2002:a17:906:58f:: with SMTP id 15mr29303939ejn.19.1567525575067; Tue, 03 Sep 2019 08:46:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567525575; cv=none; d=google.com; s=arc-20160816; b=zs3kFNt3OekmAr+kMxgNivRT9VTRRg4qkB5SDn6Cb4Hu5d9ts0tdW9hH6TAGYTJKUj JXl5Bqq+xulC94g+MHDdbsjAE3xRBJUJDVZi7XY5zuiWNtQn2FXW4e97p6p3NAhZyoC6 fiG8/DuYznQ73j8XYE+3Z2fESKMxyntet2WepKR6HdUZYDXF2mo3ClgEPuivLFP/88e2 N29fgK7JmGdm/ibJXCIPH9nFJDhAyOii6oLHrudDHLF9VE+BUFqi0H8llS8+zrdxfQr0 khWDY/z76XUm4IFDJgcckPHN/yLpaxVrz3OIVgUyI5edWIxaDqKWyDENw0L/ZtB75CWY PRVg== 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=SKHA4RaCRlFvjpRvwJ6bGEV5aXzSjabMiK2LHrB3a8I=; b=p2uvq7LgwjMEroyYjtjsaa2K4qhEv84dhC8DdotIqrHzWDKkURC3Hmm2pCqBKWuQfs UwfBM4o5TiYIsPwNE59xNpoqQTiojjSYUWkz6FbGXSp2PKH0Cwh7b/ZxjHpZBe53jsr5 hG2oMQEAPtpq5CN8pXCyF8Eep3Hxz+HmTTB8QPB40VBSDuBBviVy/NDgU0rNBLC3odcm o1tXobeZIP2lH+89XwW6sYotWFjMpFNkDmqDcf4yvX4bnuANXlfjHYxa+bgVUavG9zuJ cWTOi8JoVe6/5pFt6CJfNysox6zK4Spb4ACT6SacMU8oueOjcpkJNzrR15d6UPZoFZxn H8Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Vg+NK7CX; 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 qo28si5311313ejb.378.2019.09.03.08.46.14 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Sep 2019 08:46:15 -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=Vg+NK7CX; 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]:47766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5B0W-0001i1-3n for patch@linaro.org; Tue, 03 Sep 2019 11:46:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59269) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5ArU-0002v5-K7 for qemu-devel@nongnu.org; Tue, 03 Sep 2019 11:36:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5ArT-0005zT-Jc for qemu-devel@nongnu.org; Tue, 03 Sep 2019 11:36:52 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:33325) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5ArT-0005yw-DG for qemu-devel@nongnu.org; Tue, 03 Sep 2019 11:36:51 -0400 Received: by mail-wm1-x32f.google.com with SMTP id r17so322370wme.0 for ; Tue, 03 Sep 2019 08:36:51 -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=SKHA4RaCRlFvjpRvwJ6bGEV5aXzSjabMiK2LHrB3a8I=; b=Vg+NK7CXE0Najuibkw2vGpMbnV2Q2IOSwJUKikPvjaoTi4beCxO7gD6/2Tb/aI/Ty6 OI9W0TJzhsNMF0GDURLkCY4S+XhEBXYbJGoxd7tyghc5LxTiAoJoJwZrGZX7yjtI5WTN H9vcAdUwsNe6uMWASS8D0giOtWW9YDT40GaDAe4j1lA1CjaNnxzs2yMO10RS5MCS/4DY /beuNj/b3Xnh386DnXJWQhMeGN6i3eMqE3LAPY6tqPjOBALSA9EKkIHU0BdQAyoKbNi1 bLbtgOAbNfDfhYrIoPxKHq/mz7FAcq52dxNuqiiwDOJCTyFPIow0u6eacFSYYk/PCdIK cfOg== 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=SKHA4RaCRlFvjpRvwJ6bGEV5aXzSjabMiK2LHrB3a8I=; b=A2vXdJqW9vsvoKEpHDhf9o7ri/DMELe9eRo1fDHF2Q/aAAo482twLDmshw57QymtH/ khxP7PQmbaHP3pr+WqpXZlHzPIml/LGHwGAqYLRxhs8xULBY9cZ2gauku6RvpThkKivS HTHAHQgCJHc3mFfSxHMZNOCy8gYETPco8QSxr4O0dbh5SqfgWokyw87O52GHA8NxWso7 a6QnZ67r7vvrZwV+ld/ifF+hUCVMlAykDy92J4c6wEsFFSb/rJLN48chxapyljrcZcg8 SRCAKNuUBJfoYBsJocWUHNNyvjJpQSOijkDi+lMZsIWD2LXH4JyH2UUfdpXLB9UF4gha EFug== X-Gm-Message-State: APjAAAXnbSB05sHPvmuZzXP+E8xRqa7WaigsRzMDtojSgyp/OBgx9ehS OZmCcrqA+JwBAUa33vYh/TuOU72PqxCV3Q== X-Received: by 2002:a1c:7a14:: with SMTP id v20mr840856wmc.75.1567525010167; Tue, 03 Sep 2019 08:36:50 -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.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2019 08:36:49 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 3 Sep 2019 16:36:24 +0100 Message-Id: <20190903153633.6651-13-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::32f Subject: [Qemu-devel] [PULL 12/21] hw/arm: Use sysbus_init_child_obj for correct reference 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é Both object_initialize() and qdev_set_parent_bus() increase the reference counter of the new object, so one of the references has to be dropped afterwards to get the reference counting right. In machine model code this refcount leak is not particularly problematic because (unlike devices) machines will never be created on demand via QMP, and they are never destroyed. But in any case let's use the new sysbus_init_child_obj() instead to get the reference counting here right. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-id: 20190823143249.8096-4-philmd@redhat.com [PMM: rewrote commit message] Signed-off-by: Peter Maydell --- hw/arm/exynos4_boards.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c index f69358a5ba8..2781d8bd419 100644 --- a/hw/arm/exynos4_boards.c +++ b/hw/arm/exynos4_boards.c @@ -131,8 +131,8 @@ exynos4_boards_init_common(MachineState *machine, exynos4_boards_init_ram(s, get_system_memory(), exynos4_board_ram_size[board_type]); - object_initialize(&s->soc, sizeof(s->soc), TYPE_EXYNOS4210_SOC); - qdev_set_parent_bus(DEVICE(&s->soc), sysbus_get_default()); + sysbus_init_child_obj(OBJECT(machine), "soc", + &s->soc, sizeof(s->soc), TYPE_EXYNOS4210_SOC); object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fatal);