linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Thode <prometheanfire@gentoo.org>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: iommu@lists.linux-foundation.org, joro@8bytes.org,
	cardoe@gentoo.org, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org, mthode@mthode.org,
	ddutile@redhat.com, bhelgaas@google.com, dwmw2@infradead.org
Subject: Re: [PATCH] intel-iommu: Fix lookup in add device
Date: Tue, 13 Nov 2012 12:12:41 -0600	[thread overview]
Message-ID: <50A28D99.2000309@gentoo.org> (raw)
In-Reply-To: <20121113172144.6783.37724.stgit@bling.home>

[-- Attachment #1: Type: text/plain, Size: 1316 bytes --]

On 11/13/2012 11:22 AM, Alex Williamson wrote:
> We can't assume this device exists, fall back to the bridge itself.
> 
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> Tested-by: Matthew Thode <prometheanfire@gentoo.org>
> Cc: stable@vger.kernel.org
> ---
>  drivers/iommu/intel-iommu.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
> index d4a4cd4..0badfa4 100644
> --- a/drivers/iommu/intel-iommu.c
> +++ b/drivers/iommu/intel-iommu.c
> @@ -4108,7 +4108,7 @@ static void swap_pci_ref(struct pci_dev **from, struct pci_dev *to)
>  static int intel_iommu_add_device(struct device *dev)
>  {
>  	struct pci_dev *pdev = to_pci_dev(dev);
> -	struct pci_dev *bridge, *dma_pdev;
> +	struct pci_dev *bridge, *dma_pdev = NULL;
>  	struct iommu_group *group;
>  	int ret;
>  
> @@ -4122,7 +4122,7 @@ static int intel_iommu_add_device(struct device *dev)
>  			dma_pdev = pci_get_domain_bus_and_slot(
>  						pci_domain_nr(pdev->bus),
>  						bridge->subordinate->number, 0);
> -		else
> +		if (!dma_pdev)
>  			dma_pdev = pci_dev_get(bridge);
>  	} else
>  		dma_pdev = pci_dev_get(pdev);
> 

I've tested this and it works just fine.

-- 
-- Matthew Thode (prometheanfire)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2012-11-13 18:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-13 17:22 [PATCH] intel-iommu: Fix lookup in add device Alex Williamson
2012-11-13 18:12 ` Matthew Thode [this message]
2012-11-17 12:27 ` Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50A28D99.2000309@gentoo.org \
    --to=prometheanfire@gentoo.org \
    --cc=alex.williamson@redhat.com \
    --cc=bhelgaas@google.com \
    --cc=cardoe@gentoo.org \
    --cc=ddutile@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mthode@mthode.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).