From patchwork Wed Dec 5 20:44:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 203968 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DBB122C0106 for ; Thu, 6 Dec 2012 08:48:02 +1100 (EST) Received: from localhost ([::1]:50211 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgLqn-0001te-8m for incoming@patchwork.ozlabs.org; Wed, 05 Dec 2012 15:45:49 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52543) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgLq2-0000CM-VH for qemu-devel@nongnu.org; Wed, 05 Dec 2012 15:45:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TgLq1-0001FI-KM for qemu-devel@nongnu.org; Wed, 05 Dec 2012 15:45:02 -0500 Received: from mail-ee0-f45.google.com ([74.125.83.45]:34805) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgLq1-0001A6-Dr for qemu-devel@nongnu.org; Wed, 05 Dec 2012 15:45:01 -0500 Received: by mail-ee0-f45.google.com with SMTP id d49so3380479eek.4 for ; Wed, 05 Dec 2012 12:45:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=sriY53k/URtpIfg5V5zpeWcaXgzGLr3r/AI6KB4NTbk=; b=fcWeppkPpoGrbSLWXCzYvqV0rgvVgBu67hooHa7plrCufWKwiNWLvLGKoy4bPElJRv 4uWkr02Bi6520DVwMO+2ojXKCPDCWzCau2d9zvDMeUrXi8VDOQY6cJ6+CsvoKQ7ttxRT VASi6MqLLkJeP7LCCrb6nzAw+sduguuAtiejVFL5TjB3lhR5Upy1EVf+pgFAT3URJrkC 3R4azq52jUv1WdMmPal1tIlkyfvmdUQvrOTxs++7+7j9WCoynDA6k9ojeSaQ3jpvcmQ/ ZQzrlT8rCS/mBwokEs4LoyJguPdDpJWVzDSxVh7otaU7wTuINF8lsuPwits+s6m65uMM xJhQ== Received: by 10.14.173.65 with SMTP id u41mr64446000eel.13.1354740301009; Wed, 05 Dec 2012 12:45:01 -0800 (PST) Received: from yakj.usersys.redhat.com (93-34-219-150.ip51.fastwebnet.it. [93.34.219.150]) by mx.google.com with ESMTPS id a44sm11396163eeo.7.2012.12.05.12.44.59 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 05 Dec 2012 12:45:00 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 5 Dec 2012 21:44:38 +0100 Message-Id: <1354740282-20679-8-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.0.1 In-Reply-To: <1354740282-20679-1-git-send-email-pbonzini@redhat.com> References: <1354740282-20679-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 74.125.83.45 Cc: aliguori@us.ibm.com, afaerber@suse.de Subject: [Qemu-devel] [PATCH 07/11] qdev: add reference for the bus while it is referred to by the DeviceState X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Now that the unparent callbacks are complete, we can correctly account more missing references. Signed-off-by: Paolo Bonzini --- hw/qdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/qdev.c b/hw/qdev.c index d7f1545..62b6c14 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -101,6 +101,7 @@ static void bus_add_child(BusState *bus, DeviceState *child) void qdev_set_parent_bus(DeviceState *dev, BusState *bus) { dev->parent_bus = bus; + object_ref(OBJECT(bus)); bus_add_child(bus, dev); } @@ -734,6 +735,8 @@ static void qdev_remove_from_bus(Object *obj) } if (dev->parent_bus) { bus_remove_child(dev->parent_bus, dev); + object_unref(OBJECT(dev->parent_bus)); + dev->parent_bus = NULL; } }