RE: [PATCH rc v6] iommu: Fix nested pci_dev_reset_iommu_prepare/done()

From: Tian, Kevin

Date: Tue Apr 21 2026 - 02:59:34 EST


> From: Nicolin Chen <nicolinc@xxxxxxxxxx>
> Sent: Saturday, April 18, 2026 5:45 AM
>
> On Fri, Apr 17, 2026 at 08:24:27AM +0000, Tian, Kevin wrote:
> > the last one is trivial that goto and guard() shouldn't be mixed in one
> > function according to the cleanup guidelines.
>
> I don't think this is mixing. The guard is protecting the entire
> routine including those goto paths. So there isn't any goto path
> that is outside the mutex.
>

Here is what cleanup.h says:

* Lastly, given that the benefit of cleanup helpers is removal of
* "goto", and that the "goto" statement can jump between scopes, the
* expectation is that usage of "goto" and cleanup helpers is never
* mixed in the same function. I.e. for a given routine, convert all
* resources that need a "goto" cleanup to scope-based cleanup, or
* convert none of them.