qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 05/17] hw/vfio/ap: Fix missing ERRP_GUARD() for error_prepend


From: Zhao Liu
Subject: Re: [PATCH 05/17] hw/vfio/ap: Fix missing ERRP_GUARD() for error_prepend()
Date: Fri, 8 Mar 2024 19:39:58 +0800

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]