Skip to contentSkip to conversation

initialize dl handles where it needs to

PATCH Applied Benoit Fouet 2 participants 6 messages Jan 8, 2007

lore
Share & tools
lore
#0 lore raw

Hi,

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

src/timer/timer.c Mon Jan 8 14:22:29 2007 +0100 renamed from src/timer/timer.c Wed Dec 20 16:01:27 2006 +0100 +1 -1
diff -r b838a4b481c2 src/timer/timer.c
@@ -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);
src/timer/timer_query.c Mon Jan 8 14:22:29 2007 +0100 renamed from src/timer/timer_query.c Wed Dec 20 16:01:27 2006 +0100 +1 -1
diff -r b838a4b481c2 src/timer/timer_query.c
@@ -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);

-------------------------------------------------------------------------
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

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Applied
#1 lore raw

At Mon, 08 Jan 2007 14:37:45 +0100,

Quoted 7 lines · Benoit Fouet

Hi,

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

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

Quoted 30 lines

[2 dl_handle_init_diff <text/plain (7bit)>]
diff -r b838a4b481c2 src/timer/timer.c

src/timer/timer.c Mon Jan 8 14:22:29 2007 +0100 renamed from src/timer/timer.c Wed Dec 20 16:01:27 2006 +0100 +1 -1
@@ -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

src/timer/timer_query.c Mon Jan 8 14:22:29 2007 +0100 renamed from src/timer/timer_query.c Wed Dec 20 16:01:27 2006 +0100 +1 -1
@@ -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

Quoted 8 lines

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
[email protected]
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

#2 lore raw
Quoted 5 lines · Takashi Iwai

At Mon, 08 Jan 2007 14:37:45 +0100,

Quoted 2 lines · Benoit Fouet

Hi,

Quoted 9 lines
Quoted 5 lines

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

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);
Quoted 6 lines

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

#3 lore raw

At Mon, 08 Jan 2007 15:15:45 +0100,

Quoted 19 lines · Benoit Fouet
Quoted 5 lines · Takashi Iwai

At Mon, 08 Jan 2007 14:37:45 +0100,

Quoted 2 lines · Benoit Fouet

Hi,

Quoted 9 lines
Quoted 5 lines

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

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,

Quoted 6 lines
&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

Quoted 10 lines

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);
Quoted 3 lines

Applied to ALSA tree now. Thanks.

Quoted 7 lines
Quoted 3 lines

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

#4 lore raw
Quoted 14 lines · Takashi Iwai

At Mon, 08 Jan 2007 15:15:45 +0100,

Quoted 10 lines · Benoit Fouet

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;
        }
Quoted 4 lines

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

#5 lore raw

At Mon, 08 Jan 2007 15:50:58 +0100,

Quoted 16 lines · Benoit Fouet
Quoted 14 lines · Takashi Iwai

At Mon, 08 Jan 2007 15:15:45 +0100,

Quoted 10 lines · Benoit Fouet

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;
        }
Quoted 5 lines
Quoted 4 lines

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.

Quoted 2 lines

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