Help!

[PATCH -2nd repost 1/1] ATA: pata_via, fix double put on i..

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Kernel RSS
Next:  [GIT PULL] scheduler fixes  
Author Message
Jiri Slaby
External


Since: Nov 04, 2006
Posts: 645



PostPosted: Wed Nov 04, 2009 12:10 pm    Post subject: [PATCH -2nd repost 1/1] ATA: pata_via, fix double put on isa bridge
Archived from groups: linux>kernel (more info?)

In via_init_one, when via_isa_bridges iterator reaches
PCI_DEVICE_ID_VIA_ANON and last but one via_isa_bridges bridge is
found but rev doesn't match, pci_dev_put(isa) is called twice.

Do pci_dev_put only once.

Signed-off-by: Jiri Slaby <jirislaby DeleteThis @gmail.com>
Cc: Jeff Garzik <jgarzik DeleteThis @pobox.com>
---
drivers/ata/pata_via.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index 88984b8..520d5a3 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -526,7 +526,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.port_ops = &via_port_ops
};
const struct ata_port_info *ppi[] = { NULL, NULL };
- struct pci_dev *isa = NULL;
+ struct pci_dev *isa;
const struct via_isa_bridge *config;
static int printed_version;
u8 enable;
@@ -551,15 +551,13 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
if ((isa = pci_get_device(PCI_VENDOR_ID_VIA +
!!(config->flags & VIA_BAD_ID),
config->id, NULL))) {
+ u8 rev = isa->revision;
+ pci_dev_put(isa);

- if (isa->revision >= config->rev_min &&
- isa->revision <= config->rev_max)
+ if (rev >= config->rev_min && rev <= config->rev_max)
break;
- pci_dev_put(isa);
}

- pci_dev_put(isa);
-
if (!(config->flags & VIA_NO_ENABLES)) {
/* 0x40 low bits indicate enabled channels */
pci_read_config_byte(pdev, 0x40 , &enable);
--
1.6.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Alan Cox
External


Since: Sep 11, 2004
Posts: 1608



PostPosted: Wed Nov 04, 2009 12:10 pm    Post subject: Re: [PATCH -2nd repost 1/1] ATA: pata_via, fix double put on isa bridge [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Wed, 4 Nov 2009 17:11:03 +0100
Jiri Slaby <jirislaby.TakeThisOut@gmail.com> wrote:

> In via_init_one, when via_isa_bridges iterator reaches
> PCI_DEVICE_ID_VIA_ANON and last but one via_isa_bridges bridge is
> found but rev doesn't match, pci_dev_put(isa) is called twice.
>
> Do pci_dev_put only once.
>
> Signed-off-by: Jiri Slaby <jirislaby.TakeThisOut@gmail.com>
> Cc: Jeff Garzik <jgarzik.TakeThisOut@pobox.com>

Acked-by: Alan Cox <alan.TakeThisOut@linux.intel.com>

Definitely a far saner way to do it.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.TakeThisOut@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Jeff Garzik
External


Since: Nov 06, 2005
Posts: 162



PostPosted: Mon Nov 16, 2009 11:10 pm    Post subject: Re: [PATCH -2nd repost 1/1] ATA: pata_via, fix double put on isa bridge [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 11/04/2009 11:11 AM, Jiri Slaby wrote:
> In via_init_one, when via_isa_bridges iterator reaches
> PCI_DEVICE_ID_VIA_ANON and last but one via_isa_bridges bridge is
> found but rev doesn't match, pci_dev_put(isa) is called twice.
>
> Do pci_dev_put only once.
>
> Signed-off-by: Jiri Slaby<jirislaby.DeleteThis@gmail.com>
> Cc: Jeff Garzik<jgarzik.DeleteThis@pobox.com>
> ---
> drivers/ata/pata_via.c | 10 ++++------
> 1 files changed, 4 insertions(+), 6 deletions(-)

applied


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Kernel All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum