From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37302) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUbIS-0004et-BB for qemu-devel@nongnu.org; Thu, 18 Sep 2014 08:58:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XUbIN-0000TL-GN for qemu-devel@nongnu.org; Thu, 18 Sep 2014 08:58:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8838) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUbIN-0000SB-9q for qemu-devel@nongnu.org; Thu, 18 Sep 2014 08:58:47 -0400 Message-ID: <541AD6F8.106@redhat.com> Date: Thu, 18 Sep 2014 14:58:32 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1411044447-3124-1-git-send-email-arei.gonglei@huawei.com> <1411044447-3124-13-git-send-email-arei.gonglei@huawei.com> In-Reply-To: <1411044447-3124-13-git-send-email-arei.gonglei@huawei.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 12/19] dev-serial: convert init to realize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: arei.gonglei@huawei.com, qemu-devel@nongnu.org Cc: luonengjun@huawei.com, peter.huangpeng@huawei.com, weidong.huang@huawei.com, kraxel@redhat.com, armbru@redhat.com Il 18/09/2014 14:47, arei.gonglei@huawei.com ha scritto: > if (s->cs->be_open && !dev->attached) { > - usb_device_attach(dev, &local_err); > - if (local_err) { > - qerror_report_err(local_err); > - error_free(local_err); > - } > + usb_device_attach(dev, errp); > } > - return 0; Subtle change: realize now fails if the attach fails, i.e. if the speed is mismatched. This is a bugfix, but it doesn't happen if the backend is closed (e.g. for server socket chardevs). For a follow-up, the speed check could be extracted to a separate function usb_check_attach, that is called just once at realize time, even if !s->cs->be_open. Then, I think, all calls to usb_device_attach in dev-serial can pass &error_abort. Paolo