public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Chiang <achiang@hp.com>
To: Rakib Mullick <rakib.mullick@gmail.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>,
	linux-pci@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] pci: Make pci_dev struct point to NULL.
Date: Fri, 4 Dec 2009 13:27:09 -0700	[thread overview]
Message-ID: <20091204202709.GA32347@ldl.fc.hp.com> (raw)
In-Reply-To: <b9df5fa10912040835k3e23702o8700d2d8ad2349a4@mail.gmail.com>

* Rakib Mullick <rakib.mullick@gmail.com>:
>  pci: Make pci_dev struct point to NULL.
> 
> In function enable_device of acpiphp_glue.c, structure pci_dev
> doesn't point anything. Due to the check in line 975 we might
> end up being uninitialized. So make it point to NULL.
> 
> ---
> Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
> 
> --- linus/drivers/pci/hotplug/acpiphp_glue.c	2009-12-03 21:30:57.000000000 +0600
> +++ rakib/drivers/pci/hotplug/acpiphp_glue.c	2009-12-03 23:53:44.000000000 +0600
> @@ -964,7 +964,7 @@ static int acpiphp_bus_trim(acpi_handle
>   */
>  static int __ref enable_device(struct acpiphp_slot *slot)
>  {
> -	struct pci_dev *dev;
> +	struct pci_dev *dev = NULL;
>  	struct pci_bus *bus = slot->bridge->pci_bus;
>  	struct list_head *l;
>  	struct acpiphp_func *func;

This is from Linus's latest tree:

 965 static int __ref enable_device(struct acpiphp_slot *slot)
 966 {
 967         struct pci_dev *dev;
 968         struct pci_bus *bus = slot->bridge->pci_bus;
 969         struct list_head *l;
 970         struct acpiphp_func *func;
 971         int retval = 0;
 972         int num, max, pass;
 973         acpi_status status;
 974 
 975         if (slot->flags & SLOT_ENABLED)
 976                 goto err_exit;
 977 
 978         /* sanity check: dev should be NULL when hot-plugged in */
 979         dev = pci_get_slot(bus, PCI_DEVFN(slot->device, 0));
 980         if (dev) {

I assume your line 975 is my line 980.

pci_get_slot() returns NULL if it doesn't find the devfn, so as
far as I can tell, there's no need to initialize dev to NULL.

Were you fixing a real bug with this patch? Did you actually get
the "pci_dev structure already exists.\n" error message?

Thanks,
/ac

  reply	other threads:[~2009-12-04 20:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-04 16:35 [PATCH] pci: Make pci_dev struct point to NULL Rakib Mullick
2009-12-04 20:27 ` Alex Chiang [this message]
2009-12-05  1:53   ` Rakib Mullick
2009-12-05  4:36     ` Alex Chiang
2009-12-05  4:37       ` Alex Chiang
2009-12-05  5:18       ` Rakib Mullick
2009-12-05  5:28         ` Alex Chiang
2009-12-05  5:47           ` Rakib Mullick

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=20091204202709.GA32347@ldl.fc.hp.com \
    --to=achiang@hp.com \
    --cc=akpm@linux-foundation.org \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rakib.mullick@gmail.com \
    /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