Re: [PATCH v13 02/15] cxl: Share CXL port upstream PCI device lookup
From: Jonathan Cameron
Date: Wed Sep 23 2026 - 21:22:23 EST
> >
> > /*
> > @@ -625,11 +612,13 @@ void read_cdat_data(struct cxl_port *port)
> > port->cdat.table = buf->data;
> > port->cdat.length = length;
> >
> > - return;
> > + goto out;
Confusing flow, just duplicate the pci_dev_put()
> > err:
> > /* Don't leave table data allocated on error */
> > devm_kfree(dev, buf);
> > dev_err(dev, "Failed to read/validate CDAT.\n");
> > +out:
> > + pci_dev_put(pdev);
>
> I'd use __free() instead of introducing another goto, especially since this is the ideal
> use case for it. There should be a free action defined for this, but I can't remember what
> it's called.
Don't do that. See the guidance on where __free should be used in
cleanup.h. There are places where it 'could' be used but we don't
because it adds fragility under potential code refactoring.
Jonathan