From patchwork Fri Jan 25 11:46:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 215641 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 730302C00D1 for ; Fri, 25 Jan 2013 23:26:18 +1100 (EST) Received: from localhost ([::1]:56688 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyiMH-0000JV-V7 for incoming@patchwork.ozlabs.org; Fri, 25 Jan 2013 07:26:13 -0500 Received: from eggs.gnu.org ([208.118.235.92]:38290) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyiM6-0000JH-4N for qemu-devel@nongnu.org; Fri, 25 Jan 2013 07:26:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TyiM3-0005Hk-Jh for qemu-devel@nongnu.org; Fri, 25 Jan 2013 07:26:02 -0500 Received: from mail-qa0-f51.google.com ([209.85.216.51]:48424) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tyhki-0005CA-CH for qemu-devel@nongnu.org; Fri, 25 Jan 2013 06:47:24 -0500 Received: by mail-qa0-f51.google.com with SMTP id dx4so162524qab.10 for ; Fri, 25 Jan 2013 03:47:24 -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=4As/IBWZCAhKp+pFM89iB4voZh2POVxczGK/FzQm/lE=; b=MrssEy65g7YT97G4EoYzzv0Eavl0/kOzoxNp1bBMhgQw6OiEav7Ymmy5ymt0W7uWvC ngf8UAkGZt3SoysoRX/ei/hLEFO1AXRPd1KhjjHwblwGp/40vH/u5jQHBaGjsGzLAhxw qujOkBOJ/S44OGAtMzOWZ4prsfxfxZvXppRaDdR8c5t6Q/L8E535VCEo/dnY7pEtv42U 0dBFugvlqqoC3njpE69oXGGLrA88OiS/w8UXccfh+Of7ABlQdje/26hrMpKkweJKl0cA OGC+HsUFFa8WPfdikWoS2gzwAz/+FyMuZn3u1arfpBCvLVfuwybIe0DIvxb4YFhtJfqD 1Wzg== X-Received: by 10.49.132.199 with SMTP id ow7mr6328858qeb.56.1359114443958; Fri, 25 Jan 2013 03:47:23 -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 eg9sm419389qab.7.2013.01.25.03.47.22 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 25 Jan 2013 03:47:23 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 25 Jan 2013 12:46:56 +0100 Message-Id: <1359114420-16149-9-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.1 In-Reply-To: <1359114420-16149-1-git-send-email-pbonzini@redhat.com> References: <1359114420-16149-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.51 Cc: afaerber@suse.de Subject: [Qemu-devel] [PATCH v3 08/12] 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 b3c1e65..37a3542 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; } }