Skip to contentSkip to conversation

Fix a compile warning under gcc-4.2.3.

PATCH In review Joshua Roys 3 participants 3 messages Feb 20, 2008 – Feb 21, 2008 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix a compile warning under gcc-4.2.3.

sound/core/init.c: In function ‘snd_card_disconnect’:
sound/core/init.c:307: warning: the address of ‘snd_shutdown_f_ops’ will always evaluate as ‘true’

---
 sound/core/init.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
sound/core/init.c +0 -1
index 2cb7099..1afc58b 100644
@@ -304,7 +304,6 @@ int snd_card_disconnect(struct snd_card *card)
 		list_add(&mfile->shutdown_list, &shutdown_files);
 		spin_unlock(&shutdown_lock);
 
-		fops_get(&snd_shutdown_f_ops);
 		mfile->file->f_op = &snd_shutdown_f_ops;
 		
 		mfile = mfile->next;
Signature · 1 line
1.5.4.2
#1 lore raw
Quoted 13 lines · Joshua Roys

sound/core/init.c: In function ‘snd_card_disconnect’:
sound/core/init.c:307: warning: the address of ‘snd_shutdown_f_ops’ will always evaluate as ‘true’

---
 sound/core/init.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
sound/core/init.c +0 -0
index 2cb7099..1afc58b 100644

sound/core/init.c int snd_card_disconnect(struct snd_card *card) · line 309

Quoted 7 lines
sound/core/init.c +0 -1
@@ -304,7 +304,6 @@ int snd_card_disconnect(struct snd_card *card)
 		list_add(&mfile->shutdown_list, &shutdown_files);
 		spin_unlock(&shutdown_lock);
 
-		fops_get(&snd_shutdown_f_ops);
 		mfile->file->f_op = &snd_shutdown_f_ops;
 
 		mfile = mfile->next;

This change may get rid of the warning, but is has the slight disadvantage that the kernel will blow up if you try to unload the sound modules before all device files have been closed.

If you want to get rid of this warning, tell the compiler that fops_get knows what it does; or try making fops_get an inline function instead of a macro.

Regards,
Clemens
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#2 lore raw

At Thu, 21 Feb 2008 09:48:30 +0100,

Quoted 27 lines · Clemens Ladisch
Quoted 13 lines · Joshua Roys

sound/core/init.c: In function ‘snd_card_disconnect’:
sound/core/init.c:307: warning: the address of ‘snd_shutdown_f_ops’ will always evaluate as ‘true’

---
 sound/core/init.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
sound/core/init.c +0 -0
index 2cb7099..1afc58b 100644

sound/core/init.c int snd_card_disconnect(struct snd_card *card) · line 309

Quoted 7 lines
sound/core/init.c +0 -1
@@ -304,7 +304,6 @@ int snd_card_disconnect(struct snd_card *card)
 		list_add(&mfile->shutdown_list, &shutdown_files);
 		spin_unlock(&shutdown_lock);
 
-		fops_get(&snd_shutdown_f_ops);
 		mfile->file->f_op = &snd_shutdown_f_ops;
 
 		mfile = mfile->next;

This change may get rid of the warning, but is has the slight disadvantage that the kernel will blow up if you try to unload the sound modules before all device files have been closed.

Quoted 3 lines

If you want to get rid of this warning, tell the compiler that fops_get knows what it does; or try making fops_get an inline function instead of a macro.

This was already fixed in a different way on 2.6.25-rc.

commit bc9abce0de0b180817bc7e9f73145ef0b6a464ef

Author: Miguel Boton <[email protected]>
Date:   Sun Jan 13 12:03:53 2008 +0100

[ALSA] fix compilation warning in GCC

'snd_shutdown_f_ops' is not a pointer so its address will never be NULL. GCC will complain because 'fops_get' will do an unnecessary check because '&snd_shutdown_f_ops' is always true.

Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel