Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757302AbZLDU1H (ORCPT ); Fri, 4 Dec 2009 15:27:07 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757045AbZLDU1G (ORCPT ); Fri, 4 Dec 2009 15:27:06 -0500 Received: from g5t0009.atlanta.hp.com ([15.192.0.46]:32005 "EHLO g5t0009.atlanta.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754455AbZLDU1F (ORCPT ); Fri, 4 Dec 2009 15:27:05 -0500 Date: Fri, 4 Dec 2009 13:27:09 -0700 From: Alex Chiang To: Rakib Mullick Cc: Jesse Barnes , linux-pci@vger.kernel.org, LKML , Andrew Morton Subject: Re: [PATCH] pci: Make pci_dev struct point to NULL. Message-ID: <20091204202709.GA32347@ldl.fc.hp.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1976 Lines: 56 * Rakib Mullick : > 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 > > --- 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 -- 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/