Hi Thomas, (and also ping Markus) ;-) > > > > vfio_ap_unregister_irq_notifier(VFIOAPDevice *vapdev, > > > > static void vfio_ap_realize(DeviceState *dev, Error **errp) > > > > { > > > > + ERRP_GUARD(); > > > > int ret; > > > > Error *err = NULL; > > > > > > Now this function looks like we need both, ERRP_GUARD and the local > > > "err" variable? ... patch looks ok to me, but maybe Markus has an > > > idea how this could be done in a nicer way? > > > > > > Correct me if I'm wrong, but my understanding from reading the prologue > > in error.h is that errp is used to pass errors back to the caller. The > > 'err' variable is used to report errors set by a call to the > > vfio_ap_register_irq_notification function after which this function > > returns cleanly. > > Right, no objections, that's what I meant with "this function looks like we > need both" ... > But having both, "err" and "errp" in one function also looks somewhat > confusing at a first glance. No clue how this could be done much better > though, maybe rename "err" to "local_err" to make it clear that the two > variables are used independently? >
I agree, the "local_err" is a better name and it seems we can't get rid of this local varibale. (I can also cleanup this in the follow-up series). >From other use cases, @err is usually used to play with @errp and @local_err is (sometimes) used for local error handling. I'm also unsure if this variable naming is a convention of error handling though... Markus, what do you think about this understanding? Thanks, Zhao