All of lore.kernel.org
 help / color / mirror / Atom feed
From: Murali Karicheri <m-karicheri2@ti.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Fengguang Wu <fengguang.wu@intel.com>,
	Bjorn Helgaas <bhelgaas@google.com>, LKP <lkp@01.org>,
	<linux-pci@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PCI] BUG: unable to handle kernel
Date: Fri, 6 Mar 2015 12:50:44 -0500	[thread overview]
Message-ID: <54F9E8F4.4070106@ti.com> (raw)
In-Reply-To: <20150306165504.GA30094@roeck-us.net>

On 03/06/2015 11:55 AM, Guenter Roeck wrote:
> On Fri, Mar 06, 2015 at 10:48:59AM -0500, Murali Karicheri wrote:
> [ ... ]
>
>> > From 098b4f5e4ab9407fbdbfcca3a91785c17e25cf03 Mon Sep 17 00:00:00 2001
>> From: Murali Karicheri<m-karicheri2@ti.com>
>> Date: Fri, 6 Mar 2015 10:23:08 -0500
>> Subject: [PATCH] pci: of : fix kernel crash
>>
>> This is a debug patch to root cause the kernel crash
>>
>> 	commit 0b2af171520e5d5e7d5b5f479b90a6a5014d9df6
>>
>> 	PCI: Update DMA configuration from DT
>>
>> Signed-off-by: Murali Karicheri<m-karicheri2@ti.com>
>> ---
>>   drivers/of/of_pci.c       |    8 ++++++++
>>   drivers/pci/host-bridge.c |    5 +++++
>>   2 files changed, 13 insertions(+)
>>
>> diff --git a/drivers/of/of_pci.c b/drivers/of/of_pci.c
>> index 86d3c38..5a59fb8 100644
>> --- a/drivers/of/of_pci.c
>> +++ b/drivers/of/of_pci.c
>> @@ -129,6 +129,14 @@ 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 || !bridge->parent) {
>> +		if (!bridge)
>> +			pr_err("PCI bridge not found\n");
>> +		if (!bridge->parent)
>> +			pr_err("PCI bridge parent not found\n");
>
> You'll see a crash here if bridge is NULL. Maybe add an else before the second
> if statement ? Also, dev_err might be a bit more useful and would be available.
>
Yes. Sorry, my bad. I will fix it and re-send

Murali
> Thanks,
> Guenter
>
>> +		return;
>> +	}
>> +
>>   	of_dma_configure(dev, bridge->parent->of_node);
>>   	pci_put_host_bridge_device(bridge);
>>   }
>> diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
>> index 3e5bbf9..ef2ab51 100644
>> --- a/drivers/pci/host-bridge.c
>> +++ b/drivers/pci/host-bridge.c
>> @@ -28,6 +28,11 @@ struct device *pci_get_host_bridge_device(struct pci_dev *dev)
>>   	struct pci_bus *root_bus = find_pci_root_bus(dev->bus);
>>   	struct device *bridge = root_bus->bridge;
>>
>> +	if (!bridge) {
>> +		pr_err("PCI: bridge not found\n");
>> +		return NULL;
>> +	}
>> +
>>   	kobject_get(&bridge->kobj);
>>   	return bridge;
>>   }
>> --
>> 1.7.9.5
>>
>


-- 
Murali Karicheri
Linux Kernel, Texas Instruments

WARNING: multiple messages have this Message-ID (diff)
From: Murali Karicheri <m-karicheri2@ti.com>
To: lkp@lists.01.org
Subject: Re: [PCI] BUG: unable to handle kernel
Date: Fri, 06 Mar 2015 12:50:44 -0500	[thread overview]
Message-ID: <54F9E8F4.4070106@ti.com> (raw)
In-Reply-To: <20150306165504.GA30094@roeck-us.net>

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

On 03/06/2015 11:55 AM, Guenter Roeck wrote:
> On Fri, Mar 06, 2015 at 10:48:59AM -0500, Murali Karicheri wrote:
> [ ... ]
>
>> > From 098b4f5e4ab9407fbdbfcca3a91785c17e25cf03 Mon Sep 17 00:00:00 2001
>> From: Murali Karicheri<m-karicheri2@ti.com>
>> Date: Fri, 6 Mar 2015 10:23:08 -0500
>> Subject: [PATCH] pci: of : fix kernel crash
>>
>> This is a debug patch to root cause the kernel crash
>>
>> 	commit 0b2af171520e5d5e7d5b5f479b90a6a5014d9df6
>>
>> 	PCI: Update DMA configuration from DT
>>
>> Signed-off-by: Murali Karicheri<m-karicheri2@ti.com>
>> ---
>>   drivers/of/of_pci.c       |    8 ++++++++
>>   drivers/pci/host-bridge.c |    5 +++++
>>   2 files changed, 13 insertions(+)
>>
>> diff --git a/drivers/of/of_pci.c b/drivers/of/of_pci.c
>> index 86d3c38..5a59fb8 100644
>> --- a/drivers/of/of_pci.c
>> +++ b/drivers/of/of_pci.c
>> @@ -129,6 +129,14 @@ 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 || !bridge->parent) {
>> +		if (!bridge)
>> +			pr_err("PCI bridge not found\n");
>> +		if (!bridge->parent)
>> +			pr_err("PCI bridge parent not found\n");
>
> You'll see a crash here if bridge is NULL. Maybe add an else before the second
> if statement ? Also, dev_err might be a bit more useful and would be available.
>
Yes. Sorry, my bad. I will fix it and re-send

Murali
> Thanks,
> Guenter
>
>> +		return;
>> +	}
>> +
>>   	of_dma_configure(dev, bridge->parent->of_node);
>>   	pci_put_host_bridge_device(bridge);
>>   }
>> diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
>> index 3e5bbf9..ef2ab51 100644
>> --- a/drivers/pci/host-bridge.c
>> +++ b/drivers/pci/host-bridge.c
>> @@ -28,6 +28,11 @@ struct device *pci_get_host_bridge_device(struct pci_dev *dev)
>>   	struct pci_bus *root_bus = find_pci_root_bus(dev->bus);
>>   	struct device *bridge = root_bus->bridge;
>>
>> +	if (!bridge) {
>> +		pr_err("PCI: bridge not found\n");
>> +		return NULL;
>> +	}
>> +
>>   	kobject_get(&bridge->kobj);
>>   	return bridge;
>>   }
>> --
>> 1.7.9.5
>>
>


-- 
Murali Karicheri
Linux Kernel, Texas Instruments

  reply	other threads:[~2015-03-06 17:50 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-06  6:06 [PCI] BUG: unable to handle kernel Fengguang Wu
2015-03-06  6:06 ` Fengguang Wu
2015-03-06 15:13 ` Murali Karicheri
2015-03-06 15:13   ` Murali Karicheri
2015-03-06 15:48   ` Murali Karicheri
2015-03-06 15:48     ` Murali Karicheri
2015-03-06 16:55     ` Guenter Roeck
2015-03-06 16:55       ` Guenter Roeck
2015-03-06 17:50       ` Murali Karicheri [this message]
2015-03-06 17:50         ` Murali Karicheri
2015-03-06 17:58       ` Murali Karicheri
2015-03-06 17:58         ` Murali Karicheri
2015-03-09 14:17         ` Murali Karicheri
2015-03-09 14:17           ` Murali Karicheri
2015-03-09 14:44           ` Bjorn Helgaas
2015-03-09 14:44             ` Bjorn Helgaas
2015-03-09 15:53             ` Murali Karicheri
2015-03-09 15:53               ` Murali Karicheri
2015-03-09 16:07               ` Guenter Roeck
2015-03-09 16:07                 ` Guenter Roeck
2015-03-09 17:03                 ` Murali Karicheri
2015-03-09 17:03                   ` Murali Karicheri
2015-03-09 17:34                   ` Guenter Roeck
2015-03-09 17:34                     ` Guenter Roeck
2015-03-09 18:09                     ` Murali Karicheri
2015-03-09 18:09                       ` Murali Karicheri
2015-03-09 18:12                       ` Guenter Roeck
2015-03-09 18:12                         ` Guenter Roeck
2015-03-09 20:52                         ` Murali Karicheri
2015-03-09 20:52                           ` Murali Karicheri
2015-03-10 15:29                         ` Murali Karicheri
2015-03-10 15:29                           ` Murali Karicheri

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=54F9E8F4.4070106@ti.com \
    --to=m-karicheri2@ti.com \
    --cc=bhelgaas@google.com \
    --cc=fengguang.wu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lkp@01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.