Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1256789 > unrolled thread

Re: [PATCH V4 7/8] PCI: OF: Move of_pci_dma_configure() to pci_dma_configure()

Started byBjorn Helgaas <helgaas@kernel.org>
First post2015-10-27 15:40 +0100
Last post2015-10-27 15:40 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH V4 7/8] PCI: OF: Move of_pci_dma_configure() to  pci_dma_configure() Bjorn Helgaas <helgaas@kernel.org> - 2015-10-27 15:40 +0100

#1256789 — Re: [PATCH V4 7/8] PCI: OF: Move of_pci_dma_configure() to pci_dma_configure()

FromBjorn Helgaas <helgaas@kernel.org>
Date2015-10-27 15:40 +0100
SubjectRe: [PATCH V4 7/8] PCI: OF: Move of_pci_dma_configure() to pci_dma_configure()
Message-ID<qodzQ-6jT-35@gated-at.bofh.it>
Hi Suravee,

On Wed, Oct 21, 2015 at 08:52:10AM -0700, Suravee Suthikulpanit wrote:
> This patch move of_pci_dma_configure() to a more generic
> pci_dma_configure(), which can be extended by non-OF code (e.g. ACPI).

> -void of_pci_dma_configure(struct pci_dev *pci_dev)
> -{
> -	struct device *dev = &pci_dev->dev;
> -	struct device *bridge = pci_get_host_bridge_device(pci_dev);
> -
> -	if (!bridge->parent)
> -		return;
> -
> -	of_dma_configure(dev, bridge->parent->of_node);
> -	pci_put_host_bridge_device(bridge);
> -}

> +static void pci_dma_configure(struct pci_dev *dev)
> +{
> +	struct device *bridge = pci_get_host_bridge_device(dev);
> +
> +	if (IS_ENABLED(CONFIG_OF) && dev->dev.of_node) {
> +		if (!bridge->parent)
> +			return;

Don't we leak a bridge reference here?  This looks like it was a problem in
the original code, not something you added.  Ideally I guess I would add a
new patch that only fixes the leak in the original code, followed by this
patch that moves it from of_pci_dma_configure() to pci_dma_configure().

> +
> +		of_dma_configure(&dev->dev, bridge->parent->of_node);
> +	}
> +
> +	pci_put_host_bridge_device(bridge);
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web