All of lore.kernel.org
 help / color / mirror / Atom feed
* initialize dl handles where it needs to
@ 2007-01-08 13:37 Benoit Fouet
  2007-01-08 14:10 ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Benoit Fouet @ 2007-01-08 13:37 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 155 bytes --]

Hi,

this trivial patch initializes dl handle in timer.c and timer_query.c
where it needs to.

Signed-off-by: Benoit Fouet <benoit.fouet@purplelabs.com>



[-- Attachment #2: dl_handle_init_diff --]
[-- Type: text/plain, Size: 1028 bytes --]

diff -r b838a4b481c2 src/timer/timer.c
--- a/src/timer/timer.c Wed Dec 20 16:01:27 2006 +0100
+++ b/src/timer/timer.c Mon Jan  8 14:22:29 2007 +0100
@@ -92,7 +92,7 @@ static int snd_timer_open_conf(snd_timer
 #ifndef PIC
        extern void *snd_timer_open_symbols(void);
 #endif
-       void *h;
+       void *h = NULL;
        if (snd_config_get_type(timer_conf) != SND_CONFIG_TYPE_COMPOUND) {
                if (name)
                        SNDERR("Invalid type for TIMER %s definition", name);
diff -r b838a4b481c2 src/timer/timer_query.c
--- a/src/timer/timer_query.c   Wed Dec 20 16:01:27 2006 +0100
+++ b/src/timer/timer_query.c   Mon Jan  8 14:22:29 2007 +0100
@@ -50,7 +50,7 @@ static int snd_timer_query_open_conf(snd
 #ifndef PIC
        extern void *snd_timer_query_open_symbols(void);
 #endif
-       void *h;
+       void *h = NULL;
        if (snd_config_get_type(timer_conf) != SND_CONFIG_TYPE_COMPOUND) {
                if (name)
                        SNDERR("Invalid type for TIMER %s definition", name);

[-- Attachment #3: Type: text/plain, Size: 347 bytes --]

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

[-- Attachment #4: Type: text/plain, Size: 161 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: initialize dl handles where it needs to
  2007-01-08 13:37 initialize dl handles where it needs to Benoit Fouet
@ 2007-01-08 14:10 ` Takashi Iwai
  2007-01-08 14:15   ` Benoit Fouet
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2007-01-08 14:10 UTC (permalink / raw)
  To: Benoit Fouet; +Cc: alsa-devel

At Mon, 08 Jan 2007 14:37:45 +0100,
Benoit Fouet wrote:
> 
> Hi,
> 
> this trivial patch initializes dl handle in timer.c and timer_query.c
> where it needs to.
> 
> Signed-off-by: Benoit Fouet <benoit.fouet@purplelabs.com>

I think the code really won't access the uninitialized h, but
initializing this variable is nice for code maintenance POV, anyway.

Applied to ALSA tree now.  Thanks.


Takashi

> 
> 
> [2 dl_handle_init_diff <text/plain (7bit)>]
> diff -r b838a4b481c2 src/timer/timer.c
> --- a/src/timer/timer.c Wed Dec 20 16:01:27 2006 +0100
> +++ b/src/timer/timer.c Mon Jan  8 14:22:29 2007 +0100
> @@ -92,7 +92,7 @@ static int snd_timer_open_conf(snd_timer
>  #ifndef PIC
>         extern void *snd_timer_open_symbols(void);
>  #endif
> -       void *h;
> +       void *h = NULL;
>         if (snd_config_get_type(timer_conf) != SND_CONFIG_TYPE_COMPOUND) {
>                 if (name)
>                         SNDERR("Invalid type for TIMER %s definition", name);
> diff -r b838a4b481c2 src/timer/timer_query.c
> --- a/src/timer/timer_query.c   Wed Dec 20 16:01:27 2006 +0100
> +++ b/src/timer/timer_query.c   Mon Jan  8 14:22:29 2007 +0100
> @@ -50,7 +50,7 @@ static int snd_timer_query_open_conf(snd
>  #ifndef PIC
>         extern void *snd_timer_query_open_symbols(void);
>  #endif
> -       void *h;
> +       void *h = NULL;
>         if (snd_config_get_type(timer_conf) != SND_CONFIG_TYPE_COMPOUND) {
>                 if (name)
>                         SNDERR("Invalid type for TIMER %s definition", name);
> [3  <text/plain; us-ascii (7bit)>]
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> [4  <text/plain; us-ascii (7bit)>]
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/alsa-devel

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: initialize dl handles where it needs to
  2007-01-08 14:10 ` Takashi Iwai
@ 2007-01-08 14:15   ` Benoit Fouet
  2007-01-08 14:34     ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Benoit Fouet @ 2007-01-08 14:15 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

Takashi Iwai wrote:
> At Mon, 08 Jan 2007 14:37:45 +0100,
> Benoit Fouet wrote:
>   
>> Hi,
>>
>> this trivial patch initializes dl handle in timer.c and timer_query.c
>> where it needs to.
>>
>> Signed-off-by: Benoit Fouet <benoit.fouet@purplelabs.com>
>>     
>
> I think the code really won't access the uninitialized h, but
> initializing this variable is nice for code maintenance POV, anyway.
>   
reading it quickly, i found one case reaching this point:
around line 120 in timer.c:
err = snd_config_search_definition(timer_root, "timer_type", str,
&type_conf);
    if (err >= 0) {
        if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
            SNDERR("Invalid type for TIMER type %s definition", str);
            goto _err;
        }

in which case we reach the _err label with err equal to zero:
if (! err) {
        err = open_func(timer, name, timer_root, timer_conf, mode);
        if (err < 0)
            snd_dlclose(h);

> Applied to ALSA tree now.  Thanks.
>
>
> Takashi
>
>   
Thanks

Ben


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: initialize dl handles where it needs to
  2007-01-08 14:15   ` Benoit Fouet
@ 2007-01-08 14:34     ` Takashi Iwai
  2007-01-08 14:50       ` Benoit Fouet
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2007-01-08 14:34 UTC (permalink / raw)
  To: Benoit Fouet; +Cc: alsa-devel

At Mon, 08 Jan 2007 15:15:45 +0100,
Benoit Fouet wrote:
> 
> Takashi Iwai wrote:
> > At Mon, 08 Jan 2007 14:37:45 +0100,
> > Benoit Fouet wrote:
> >   
> >> Hi,
> >>
> >> this trivial patch initializes dl handle in timer.c and timer_query.c
> >> where it needs to.
> >>
> >> Signed-off-by: Benoit Fouet <benoit.fouet@purplelabs.com>
> >>     
> >
> > I think the code really won't access the uninitialized h, but
> > initializing this variable is nice for code maintenance POV, anyway.
> >   
> reading it quickly, i found one case reaching this point:
> around line 120 in timer.c:
> err = snd_config_search_definition(timer_root, "timer_type", str,
> &type_conf);
>     if (err >= 0) {
>         if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
>             SNDERR("Invalid type for TIMER type %s definition", str);
>             goto _err;
>         }

Ah, in that case, we should set err in a real error code such as
-EINVAL.


Takashi

> 
> in which case we reach the _err label with err equal to zero:
> if (! err) {
>         err = open_func(timer, name, timer_root, timer_conf, mode);
>         if (err < 0)
>             snd_dlclose(h);
> 
> > Applied to ALSA tree now.  Thanks.
> >
> >
> > Takashi
> >
> >   
> Thanks
> 
> Ben
> 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: initialize dl handles where it needs to
  2007-01-08 14:34     ` Takashi Iwai
@ 2007-01-08 14:50       ` Benoit Fouet
  2007-01-08 15:25         ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Benoit Fouet @ 2007-01-08 14:50 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

Takashi Iwai wrote:
> At Mon, 08 Jan 2007 15:15:45 +0100,
> Benoit Fouet wrote:
>   
>> reading it quickly, i found one case reaching this point:
>> around line 120 in timer.c:
>> err = snd_config_search_definition(timer_root, "timer_type", str,
>> &type_conf);
>>     if (err >= 0) {
>>         if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
>>             SNDERR("Invalid type for TIMER type %s definition", str);
>>             goto _err;
>>         }
>>     
>
> Ah, in that case, we should set err in a real error code such as
> -EINVAL.
>
>   
yes, could be a good idea...
in that case, my previous patch is useless, even if the warning will
surely still be there.

Ben


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: initialize dl handles where it needs to
  2007-01-08 14:50       ` Benoit Fouet
@ 2007-01-08 15:25         ` Takashi Iwai
  0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2007-01-08 15:25 UTC (permalink / raw)
  To: Benoit Fouet; +Cc: alsa-devel

At Mon, 08 Jan 2007 15:50:58 +0100,
Benoit Fouet wrote:
> 
> Takashi Iwai wrote:
> > At Mon, 08 Jan 2007 15:15:45 +0100,
> > Benoit Fouet wrote:
> >   
> >> reading it quickly, i found one case reaching this point:
> >> around line 120 in timer.c:
> >> err = snd_config_search_definition(timer_root, "timer_type", str,
> >> &type_conf);
> >>     if (err >= 0) {
> >>         if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
> >>             SNDERR("Invalid type for TIMER type %s definition", str);
> >>             goto _err;
> >>         }
> >>     
> >
> > Ah, in that case, we should set err in a real error code such as
> > -EINVAL.
> >
> >   
> yes, could be a good idea...

I'll fix it now.

> in that case, my previous patch is useless, even if the warning will
> surely still be there.

Yup, but it's still worth as I mentioned from maintenance POV.

thanks,

Takashi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-01-08 15:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-08 13:37 initialize dl handles where it needs to Benoit Fouet
2007-01-08 14:10 ` Takashi Iwai
2007-01-08 14:15   ` Benoit Fouet
2007-01-08 14:34     ` Takashi Iwai
2007-01-08 14:50       ` Benoit Fouet
2007-01-08 15:25         ` Takashi Iwai

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.