> From: Paolo Bonzini [mailto:pbonz...@redhat.com] > Sent: Thursday, September 18, 2014 8:59 PM > Subject: Re: [PATCH v2 12/19] dev-serial: convert init to realize > > Il 18/09/2014 14:47, arei.gong...@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). > Yes. Good catch. :)
> 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. > Yes, we can. Can we use qerror_report_err still in realize function? Just report this error but not propagate to the caller. Thanks! Best regards, -Gonglei