Re: i810_audio MMIO patch

From: Takashi Iwai
Date: Mon Jul 12 2004 - 04:39:10 EST


At Sun, 04 Jul 2004 11:50:28 -0400,
Jeff Garzik wrote:
>
> John Linville wrote:
> > Attached is a second patch to account for (most of) Herbert Xu's
> > comments.
> >
> > I have left-out the part about changing state->card to a
> > local variable where it is used a lot. Unfortunately, that usage is
> > somewhat pervasive and I would prefer to make those changes in a separate
> > patch -- after I have had a chance to do some testing.
> >
> > If you'd prefer one patch to account for the original plus these
> > changes, let me know and I'll be happy to provide it.
>
> I forwarded this and the main patch to Andrew, for some testing -mm.
> Then push it upstream.

While we're here, please check the following patch, too?


thanks,

--
Takashi Iwai <tiwai@xxxxxxx> ALSA Developer - www.alsa-project.org

================================================================

i810_audio: Fix the error path of resource management

The patch adds the check of return value from resquest_region() to
avoid the confliction of resource management with ALSA intel8x0
driver.


Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>

--- linux-2.6.7/sound/oss/i810_audio.c 2004-06-16 07:19:44.000000000 +0200
+++ linux-2.6.7/sound/oss/i810_audio.c 2004-07-12 11:27:41.824157288 +0200
@@ -3184,8 +3184,14 @@ static int __devinit i810_probe(struct p
}

/* claim our iospace and irq */
- request_region(card->iobase, 64, card_names[pci_id->driver_data]);
- request_region(card->ac97base, 256, card_names[pci_id->driver_data]);
+ if (! request_region(card->iobase, 64, card_names[pci_id->driver_data])) {
+ printk(KERN_ERR "i810_audio: unable to allocate region %lx\n", card->iobase);
+ goto out_region1;
+ }
+ if (! request_region(card->ac97base, 256, card_names[pci_id->driver_data])) {
+ printk(KERN_ERR "i810_audio: unable to allocate region %lx\n", card->ac97base);
+ goto out_region2;
+ }

if (request_irq(card->irq, &i810_interrupt, SA_SHIRQ,
card_names[pci_id->driver_data], card)) {
@@ -3259,7 +3265,9 @@ out_iospace:
}
out_pio:
release_region(card->iobase, 64);
+out_region2:
release_region(card->ac97base, 256);
+out_region1:
pci_free_consistent(pci_dev, sizeof(struct i810_channel)*NR_HW_CH,
card->channel, card->chandma);
out_mem:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/