From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wx2GO-00051V-EF for qemu-devel@nongnu.org; Tue, 17 Jun 2014 18:54:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wx2GE-0004VQ-O8 for qemu-devel@nongnu.org; Tue, 17 Jun 2014 18:54:00 -0400 Received: from mail-we0-x232.google.com ([2a00:1450:400c:c03::232]:54059) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wx2GE-0004Uv-HF for qemu-devel@nongnu.org; Tue, 17 Jun 2014 18:53:50 -0400 Received: by mail-we0-f178.google.com with SMTP id x48so23336wes.37 for ; Tue, 17 Jun 2014 15:53:46 -0700 (PDT) Date: Tue, 17 Jun 2014 23:53:39 +0100 From: Hani Benhabiles Message-ID: <20140617225312.GA18998@Inspiron-3521> References: <1402507536-15437-1-git-send-email-kroosec@gmail.com> <5398A6C0.3080803@redhat.com> <20140615213742.GB5854@Inspiron-3521> <539EB23A.7030608@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <539EB23A.7030608@redhat.com> Subject: Re: [Qemu-devel] [PATCH] usb: Fix usb-bt-dongle segfault. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, kraxel@redhat.com On Mon, Jun 16, 2014 at 11:00:42AM +0200, Paolo Bonzini wrote: > Il 15/06/2014 23:37, Hani Benhabiles ha scritto: > >>>diff --git a/hw/usb/dev-bluetooth.c b/hw/usb/dev-bluetooth.c > >>>index a9661d2..6d02343 100644 > >>>--- a/hw/usb/dev-bluetooth.c > >>>+++ b/hw/usb/dev-bluetooth.c > >>>@@ -506,6 +506,12 @@ static int usb_bt_initfn(USBDevice *dev) > >>> > >>> usb_desc_create_serial(dev); > >>> usb_desc_init(dev); > >>>+ s->dev.opaque = s; > >>>+ s->hci = bt_new_hci(qemu_find_bt_vlan(0)); > >>>+ s->hci->opaque = s; > >>>+ s->hci->evt_recv = usb_bt_out_hci_packet_event; > >>>+ s->hci->acl_recv = usb_bt_out_hci_packet_acl; > >>>+ usb_bt_handle_reset(&s->dev); > >> > >> > >>All lines but the s->hci assignment should be removed from usb_bt_init too. > >> > >>As to s->hci, I suggest inlining usb_create_simple into usb_bt_init, and > >>initializing s->hci there before doing the qdev_init() call. > >> > >>Then here you can wrap the assignment under "if (!s->hci)". > > > >I am afraid I don't quite understand what you want to achieve with this and why. > > > >Could you please explain how is usb_bt_init() relevant to this case ? > > usb_bt_init() ends up calling usb_bt_initfn(), via usb_create_simple. So if > you add code to usb_bt_initfn() you can remove the corresponding lines in > usb_bt_init(). Thanks for the clarification. I forgot about -usbdevice bt, will send v2 shortly.