[Very RFC 40/46] powernv/npu: Don't drop refcount when looking up GPU pci_devs

Oliver O'Halloran oohall at gmail.com
Wed Nov 27 20:40:00 AEDT 2019


On Wed, Nov 27, 2019 at 8:34 PM Greg Kurz <groug at kaod.org> wrote:
>
>
> If everyone is ok with leaking a reference in the NPU case, I guess
> this isn't a problem. But if we move forward with Oliver's patch, a
> pci_dev_put() would be needed for OpenCAPI, correct ?

Yes, but I think that's fair enough. By convention it's the callers
responsibility to drop the ref when it calls a function that returns a
refcounted object. Doing anything else creates a race condition since
the object's count could drop to zero before the caller starts using
it.

Oliver


More information about the Linuxppc-dev mailing list