* [PATCH 1/2] pdc202xx_new: fix PCI refcounting
@ 2007-08-18 18:46 Sergei Shtylyov
2007-08-21 20:01 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 3+ messages in thread
From: Sergei Shtylyov @ 2007-08-18 18:46 UTC (permalink / raw)
To: bzolnier; +Cc: linux-ide
The driver erroneously "lets go" the mate IDE chip in init_setup_pdc20270()
when ide_setup_pci_devices() call succeeds -- fix this, and drop a couple of
useless assignments in this function while at it...
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
---
This patch is against the current Linus' tree, it has only been compile tested
since I do not have PDC2027x chips (and even less so behind DC21150 bridge :-).
drivers/ide/pci/pdc202xx_new.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
Index: linux-2.6/drivers/ide/pci/pdc202xx_new.c
===================================================================
--- linux-2.6.orig/drivers/ide/pci/pdc202xx_new.c
+++ linux-2.6/drivers/ide/pci/pdc202xx_new.c
@@ -9,7 +9,7 @@
* Split from:
* linux/drivers/ide/pdc202xx.c Version 0.35 Mar. 30, 2002
* Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>
- * Copyright (C) 2005-2006 MontaVista Software, Inc.
+ * Copyright (C) 2005-2007 MontaVista Software, Inc.
* Portions Copyright (C) 1999 Promise Technology, Inc.
* Author: Frank Tiernan (frankt@promise.com)
* Released under terms of General Public License
@@ -521,7 +521,7 @@ static int __devinit init_setup_pdcnew(s
static int __devinit init_setup_pdc20270(struct pci_dev *dev,
ide_pci_device_t *d)
{
- struct pci_dev *findev = NULL;
+ struct pci_dev *findev;
int ret;
if ((dev->bus->self &&
@@ -529,7 +529,7 @@ static int __devinit init_setup_pdc20270
(dev->bus->self->device == PCI_DEVICE_ID_DEC_21150)) {
if (PCI_SLOT(dev->devfn) & 2)
return -ENODEV;
- d->extra = 0;
+
while ((findev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, findev)) != NULL) {
if ((findev->vendor == dev->vendor) &&
(findev->device == dev->device) &&
@@ -538,7 +538,8 @@ static int __devinit init_setup_pdc20270
findev->irq = dev->irq;
}
ret = ide_setup_pci_devices(dev, findev, d);
- pci_dev_put(findev);
+ if (ret < 0)
+ pci_dev_put(findev);
return ret;
}
}
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 1/2] pdc202xx_new: fix PCI refcounting
2007-08-18 18:46 [PATCH 1/2] pdc202xx_new: fix PCI refcounting Sergei Shtylyov
@ 2007-08-21 20:01 ` Bartlomiej Zolnierkiewicz
2007-08-26 12:56 ` Sergei Shtylyov
0 siblings, 1 reply; 3+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2007-08-21 20:01 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: linux-ide
On Saturday 18 August 2007, Sergei Shtylyov wrote:
> The driver erroneously "lets go" the mate IDE chip in init_setup_pdc20270()
> when ide_setup_pci_devices() call succeeds -- fix this, and drop a couple of
> useless assignments in this function while at it...
>
> Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
applied but
> ---
> This patch is against the current Linus' tree, it has only been compile tested
> since I do not have PDC2027x chips (and even less so behind DC21150 bridge :-).
>
> drivers/ide/pci/pdc202xx_new.c | 9 +++++----
> 1 files changed, 5 insertions(+), 4 deletions(-)
>
> Index: linux-2.6/drivers/ide/pci/pdc202xx_new.c
> ===================================================================
> --- linux-2.6.orig/drivers/ide/pci/pdc202xx_new.c
> +++ linux-2.6/drivers/ide/pci/pdc202xx_new.c
> @@ -9,7 +9,7 @@
> * Split from:
> * linux/drivers/ide/pdc202xx.c Version 0.35 Mar. 30, 2002
> * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>
> - * Copyright (C) 2005-2006 MontaVista Software, Inc.
> + * Copyright (C) 2005-2007 MontaVista Software, Inc.
> * Portions Copyright (C) 1999 Promise Technology, Inc.
> * Author: Frank Tiernan (frankt@promise.com)
> * Released under terms of General Public License
> @@ -521,7 +521,7 @@ static int __devinit init_setup_pdcnew(s
> static int __devinit init_setup_pdc20270(struct pci_dev *dev,
> ide_pci_device_t *d)
> {
> - struct pci_dev *findev = NULL;
> + struct pci_dev *findev;
drivers/ide/pci/pdc202xx_new.c: In function ‘init_setup_pdc20270’:
drivers/ide/pci/pdc202xx_new.c:530: warning: ‘findev’ may be used uninitialized in this function
with gcc version 4.1.2 20070626 (Red Hat 4.1.2-13)
Seems to be gcc problem but I reverted this chunk.
Update: after applying patch #2/2 and fixing the reject caused by the above change
warning disappears (patch #2/2 besides renaming "findev" to "dev2" moves the code
around making it easier for gcc to deduce what is going on :).
> int ret;
>
> if ((dev->bus->self &&
> @@ -529,7 +529,7 @@ static int __devinit init_setup_pdc20270
> (dev->bus->self->device == PCI_DEVICE_ID_DEC_21150)) {
> if (PCI_SLOT(dev->devfn) & 2)
> return -ENODEV;
> - d->extra = 0;
> +
> while ((findev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, findev)) != NULL) {
> if ((findev->vendor == dev->vendor) &&
> (findev->device == dev->device) &&
> @@ -538,7 +538,8 @@ static int __devinit init_setup_pdc20270
> findev->irq = dev->irq;
> }
> ret = ide_setup_pci_devices(dev, findev, d);
> - pci_dev_put(findev);
> + if (ret < 0)
> + pci_dev_put(findev);
> return ret;
> }
> }
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 1/2] pdc202xx_new: fix PCI refcounting
2007-08-21 20:01 ` Bartlomiej Zolnierkiewicz
@ 2007-08-26 12:56 ` Sergei Shtylyov
0 siblings, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2007-08-26 12:56 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide
Bartlomiej Zolnierkiewicz wrote:
>>The driver erroneously "lets go" the mate IDE chip in init_setup_pdc20270()
>>when ide_setup_pci_devices() call succeeds -- fix this, and drop a couple of
>>useless assignments in this function while at it...
>>Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
> applied but
>>---
>>This patch is against the current Linus' tree, it has only been compile tested
>>since I do not have PDC2027x chips (and even less so behind DC21150 bridge :-).
>>Index: linux-2.6/drivers/ide/pci/pdc202xx_new.c
>>===================================================================
>>--- linux-2.6.orig/drivers/ide/pci/pdc202xx_new.c
>>+++ linux-2.6/drivers/ide/pci/pdc202xx_new.c
[...]
>>@@ -521,7 +521,7 @@ static int __devinit init_setup_pdcnew(s
>> static int __devinit init_setup_pdc20270(struct pci_dev *dev,
>> ide_pci_device_t *d)
>> {
>>- struct pci_dev *findev = NULL;
>>+ struct pci_dev *findev;
> drivers/ide/pci/pdc202xx_new.c: In function ‘init_setup_pdc20270’:
> drivers/ide/pci/pdc202xx_new.c:530: warning: ‘findev’ may be used uninitialized in this function
> with gcc version 4.1.2 20070626 (Red Hat 4.1.2-13)
> Seems to be gcc problem
No, it must be all those pills I'm taking... ;-)
> but I reverted this chunk.
And you were absolutely right -- findev must be NULL for the search to go
thru all the PCI devices. :-/
> Update: after applying patch #2/2 and fixing the reject caused by the above change
> warning disappears (patch #2/2 besides renaming "findev" to "dev2" moves the code
> around making it easier for gcc to deduce what is going on :).
Right, because pci_get_slot() is not a "device scanner" and so doesn't
need the starting node.
I guess there's no need to recast now?
WBR, Sergei
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-08-26 12:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-18 18:46 [PATCH 1/2] pdc202xx_new: fix PCI refcounting Sergei Shtylyov
2007-08-21 20:01 ` Bartlomiej Zolnierkiewicz
2007-08-26 12:56 ` Sergei Shtylyov
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).