All of lore.kernel.org
 help / color / mirror / Atom feed
From: Domen Puncer <domen@coderock.org>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] [PATCH] oss/btaudio.c: Check ioremap return value and free
Date: Mon, 04 Sep 2006 22:04:53 +0000	[thread overview]
Message-ID: <20060904220453.GD26935@nd47.coderock.org> (raw)
In-Reply-To: <1157300808.6767.10.camel@localhost.localdomain>

On 03/09/06 19:26 +0300, ville palo wrote:
> 
> Check return value of the ioremap() and balance ioremap()
> with iounmap().
> 
> Signed-off-by: Ville Palo <ville.palo@vi64pa.net>
> 
> diff --git a/sound/oss/btaudio.c b/sound/oss/btaudio.c
> index 324a81f..9b1837f 100644
> --- a/sound/oss/btaudio.c
> +++ b/sound/oss/btaudio.c
> @@ -927,6 +927,10 @@ static int __devinit btaudio_probe(struc
>  	bta->mem  = pci_resource_start(pci_dev,0);
>  	bta->mmio = ioremap(pci_resource_start(pci_dev,0),
>  			    pci_resource_len(pci_dev,0));
> +	if (!bta->mmio) {
> +		rc = -EIO;
> +		goto fail1;
> +	}
>  
>  	bta->source     = 1;
>  	bta->bits       = 8;
> @@ -1019,6 +1023,7 @@ static int __devinit btaudio_probe(struc
>  		unregister_sound_dsp(bta->dsp_digital);
>   fail2:
>          free_irq(bta->irq,bta);	
> +	iounmap(bta->mmio);

Why here?
This won't work if ie. request_irq fails.


	Domen

>   fail1:
>  	kfree(bta);
>   fail0:
> @@ -1047,6 +1052,8 @@ static void __devexit btaudio_remove(str
>  	}
>  
>  	/* free resources */
> +	if (bta->mmio)
> +		iounmap(bta->mmio);
>  	free_buffer(bta);
>          free_irq(bta->irq,bta);
>  	release_mem_region(pci_resource_start(pci_dev,0),
> 
> 
> _______________________________________________
> Kernel-janitors mailing list
> Kernel-janitors@lists.osdl.org
> https://lists.osdl.org/mailman/listinfo/kernel-janitors
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

  reply	other threads:[~2006-09-04 22:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-03 16:26 [KJ] [PATCH] oss/btaudio.c: Check ioremap return value and free ville palo
2006-09-04 22:04 ` Domen Puncer [this message]
2006-09-05 13:11 ` ville palo

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=20060904220453.GD26935@nd47.coderock.org \
    --to=domen@coderock.org \
    --cc=kernel-janitors@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.