From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49868) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xm0U0-0001lD-BX for qemu-devel@nongnu.org; Wed, 05 Nov 2014 08:18:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xm0Tu-00063m-Vj for qemu-devel@nongnu.org; Wed, 05 Nov 2014 08:18:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47033) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xm0Tu-00063W-PA for qemu-devel@nongnu.org; Wed, 05 Nov 2014 08:18:38 -0500 Message-ID: <545A23A7.7090401@redhat.com> Date: Wed, 05 Nov 2014 14:18:31 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1415182311-13799-1-git-send-email-syeon.hwang@samsung.com> <20141105124609.GA4354@redhat.com> <87lhnpn5y1.fsf@blackfin.pond.sub.org> In-Reply-To: <87lhnpn5y1.fsf@blackfin.pond.sub.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] pci: fixed mismatch of error-handling between pci_qdev_init() and qdev List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org, SeokYeon Hwang On 05/11/2014 14:16, Markus Armbruster wrote: > "Michael S. Tsirkin" writes: > >> On Wed, Nov 05, 2014 at 07:11:51PM +0900, SeokYeon Hwang wrote: >>> pci_qdev_init() checks whether return value is 0 or not to figure >>> out pci device is initialized successfully. Otherwise, >>> device_realize() in qdev checks that return value is negative value >>> to figure out the device is realized successfully. >>> When pci device returns positive number, pci_qdev_init() thinks that >>> error is occured and makes the device unregistered. Nevertheless, >>> qdev thinks that device is realized. >>> Finally, crash is occured by commands like 'qtree' that traverse qdev list. >>> >>> So, pci_qdev_init() returns -1 when init function returns not 0. >>> >>> Signed-off-by: SeokYeon Hwang >> >> Question: is there a simple way to trigger this error? > > Next question: what's the contract of PCIDeviceClass method init()? > Positive return value feels like bug to me... I think bypassing the question by converting to realize makes the most sense... Paolo