* [PATCH] sound/oss/msnd_pinnacle.c: add vfrees
@ 2012-04-09 8:16 Julia Lawall
2012-04-10 6:42 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2012-04-09 8:16 UTC (permalink / raw)
To: Andrew Veliath
Cc: kernel-janitors, Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
At the point of this error-handling code, HAVE_DSPCODEH may be undefined,
so free INITCODE and PERMCODE as done elsewhere. A jump and label are
introduced to avoid code duplication.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
sound/oss/msnd_pinnacle.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/sound/oss/msnd_pinnacle.c b/sound/oss/msnd_pinnacle.c
index 2c79d60..536c4c0 100644
--- a/sound/oss/msnd_pinnacle.c
+++ b/sound/oss/msnd_pinnacle.c
@@ -1294,6 +1294,8 @@ static int __init calibrate_adc(WORD srate)
static int upload_dsp_code(void)
{
+ int ret = 0;
+
msnd_outb(HPBLKSEL_0, dev.io + HP_BLKS);
#ifndef HAVE_DSPCODEH
INITCODESIZE = mod_firmware_load(INITCODEFILE, &INITCODE);
@@ -1312,7 +1314,8 @@ static int upload_dsp_code(void)
memcpy_toio(dev.base, PERMCODE, PERMCODESIZE);
if (msnd_upload_host(&dev, INITCODE, INITCODESIZE) < 0) {
printk(KERN_WARNING LOGNAME ": Error uploading to DSP\n");
- return -ENODEV;
+ ret = -ENODEV;
+ goto out;
}
#ifdef HAVE_DSPCODEH
printk(KERN_INFO LOGNAME ": DSP firmware uploaded (resident)\n");
@@ -1320,12 +1323,13 @@ static int upload_dsp_code(void)
printk(KERN_INFO LOGNAME ": DSP firmware uploaded\n");
#endif
+out:
#ifndef HAVE_DSPCODEH
vfree(INITCODE);
vfree(PERMCODE);
#endif
- return 0;
+ return ret;
}
#ifdef MSND_CLASSIC
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] sound/oss/msnd_pinnacle.c: add vfrees
2012-04-09 8:16 [PATCH] sound/oss/msnd_pinnacle.c: add vfrees Julia Lawall
@ 2012-04-10 6:42 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2012-04-10 6:42 UTC (permalink / raw)
To: Julia Lawall
Cc: Andrew Veliath, kernel-janitors, Jaroslav Kysela, alsa-devel,
linux-kernel
At Mon, 9 Apr 2012 10:16:32 +0200,
Julia Lawall wrote:
>
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> At the point of this error-handling code, HAVE_DSPCODEH may be undefined,
> so free INITCODE and PERMCODE as done elsewhere. A jump and label are
> introduced to avoid code duplication.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Thanks, applied now.
Takashi
>
> ---
> sound/oss/msnd_pinnacle.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/sound/oss/msnd_pinnacle.c b/sound/oss/msnd_pinnacle.c
> index 2c79d60..536c4c0 100644
> --- a/sound/oss/msnd_pinnacle.c
> +++ b/sound/oss/msnd_pinnacle.c
> @@ -1294,6 +1294,8 @@ static int __init calibrate_adc(WORD srate)
>
> static int upload_dsp_code(void)
> {
> + int ret = 0;
> +
> msnd_outb(HPBLKSEL_0, dev.io + HP_BLKS);
> #ifndef HAVE_DSPCODEH
> INITCODESIZE = mod_firmware_load(INITCODEFILE, &INITCODE);
> @@ -1312,7 +1314,8 @@ static int upload_dsp_code(void)
> memcpy_toio(dev.base, PERMCODE, PERMCODESIZE);
> if (msnd_upload_host(&dev, INITCODE, INITCODESIZE) < 0) {
> printk(KERN_WARNING LOGNAME ": Error uploading to DSP\n");
> - return -ENODEV;
> + ret = -ENODEV;
> + goto out;
> }
> #ifdef HAVE_DSPCODEH
> printk(KERN_INFO LOGNAME ": DSP firmware uploaded (resident)\n");
> @@ -1320,12 +1323,13 @@ static int upload_dsp_code(void)
> printk(KERN_INFO LOGNAME ": DSP firmware uploaded\n");
> #endif
>
> +out:
> #ifndef HAVE_DSPCODEH
> vfree(INITCODE);
> vfree(PERMCODE);
> #endif
>
> - return 0;
> + return ret;
> }
>
> #ifdef MSND_CLASSIC
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-04-10 6:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-09 8:16 [PATCH] sound/oss/msnd_pinnacle.c: add vfrees Julia Lawall
2012-04-10 6:42 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®