From patchwork Fri Jan 25 13:12:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 215688 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 63A222C0085 for ; Sat, 26 Jan 2013 00:54:40 +1100 (EST) Received: from localhost ([::1]:42303 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tyj6h-0000GV-Cs for incoming@patchwork.ozlabs.org; Fri, 25 Jan 2013 08:14:11 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tyj5i-0007Kf-72 for qemu-devel@nongnu.org; Fri, 25 Jan 2013 08:13:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tyj5d-0002BW-2S for qemu-devel@nongnu.org; Fri, 25 Jan 2013 08:13:09 -0500 Received: from mail-qa0-f52.google.com ([209.85.216.52]:56970) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tyj5c-0002BK-Vs for qemu-devel@nongnu.org; Fri, 25 Jan 2013 08:13:05 -0500 Received: by mail-qa0-f52.google.com with SMTP id bs12so206903qab.4 for ; Fri, 25 Jan 2013 05:13:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=MogFNHcS3o3w8fPz0evCzzNJKF0UIiQA6fkqy2n9hXc=; b=pVqzgQt1pjWefn70bgUZDephzc+sbwhtsK3bg2wyI5ZHRZxdziTM2lpscsPA6fDiNT angzvLuONkgBArA5hvT+2RcumZAGpkcnFJZ9aEWgKoBUQ9o84dNrGyQAaw4x4Z5bqb/p h5rBOWybpC+Oss/SZZEmM/3TVBgjfuBu32yR/Q8aaBivuse28XwfFZ0wZ56pDsNg0DSx aKpDnexMiNng5hd+D37A0DQNO7HKX5uL7W8txfMGRnSbbRK8S5Sc5VW/uWpbrlWMDJJu sNi6nDKZ6+B+001/mjf7i82SCJ001x9T59woOdJLUMN14VwsadyLHGzPBEyS02ZlyMZC 4a0w== X-Received: by 10.49.131.67 with SMTP id ok3mr6778863qeb.42.1359119584622; Fri, 25 Jan 2013 05:13:04 -0800 (PST) Received: from yakj.usersys.redhat.com (93-34-179-137.ip50.fastwebnet.it. [93.34.179.137]) by mx.google.com with ESMTPS id u8sm416277qeu.2.2013.01.25.05.13.02 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 25 Jan 2013 05:13:03 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 25 Jan 2013 14:12:35 +0100 Message-Id: <1359119559-19075-10-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.1 In-Reply-To: <1359119559-19075-1-git-send-email-pbonzini@redhat.com> References: <1359119559-19075-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.216.52 Cc: afaerber@suse.de Subject: [Qemu-devel] [PATCH v4 09/13] 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 6f1b311..1dabcad 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -100,6 +100,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); } @@ -773,6 +774,8 @@ static void device_unparent(Object *obj) } if (dev->parent_bus) { bus_remove_child(dev->parent_bus, dev); + object_unref(OBJECT(dev->parent_bus)); + dev->parent_bus = NULL; } }