public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sound: fix check for error condition of register_chrdev()
@ 2015-11-06 22:56 Alexey Khoroshilov
  2015-11-07 10:15 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Khoroshilov @ 2015-11-06 22:56 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai
  Cc: Alexey Khoroshilov, alsa-devel, linux-kernel, ldv-project

init_oss_soundcore() compares returned value of register_chrdev()
with -1, while other error codes can be returned.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 sound/sound_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/sound_core.c b/sound/sound_core.c
index 11e953a1fa45..99b73c675743 100644
--- a/sound/sound_core.c
+++ b/sound/sound_core.c
@@ -655,7 +655,7 @@ static void cleanup_oss_soundcore(void)
 static int __init init_oss_soundcore(void)
 {
 	if (preclaim_oss &&
-	    register_chrdev(SOUND_MAJOR, "sound", &soundcore_fops) == -1) {
+	    register_chrdev(SOUND_MAJOR, "sound", &soundcore_fops) < 0) {
 		printk(KERN_ERR "soundcore: sound device already in use.\n");
 		return -EBUSY;
 	}
-- 
1.9.1


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

* Re: [PATCH] sound: fix check for error condition of register_chrdev()
  2015-11-06 22:56 [PATCH] sound: fix check for error condition of register_chrdev() Alexey Khoroshilov
@ 2015-11-07 10:15 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2015-11-07 10:15 UTC (permalink / raw)
  To: Alexey Khoroshilov; +Cc: Jaroslav Kysela, alsa-devel, ldv-project, linux-kernel

On Fri, 06 Nov 2015 23:56:05 +0100,
Alexey Khoroshilov wrote:
> 
> init_oss_soundcore() compares returned value of register_chrdev()
> with -1, while other error codes can be returned.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>

Thanks, applied.


Takashi

> ---
>  sound/sound_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/sound_core.c b/sound/sound_core.c
> index 11e953a1fa45..99b73c675743 100644
> --- a/sound/sound_core.c
> +++ b/sound/sound_core.c
> @@ -655,7 +655,7 @@ static void cleanup_oss_soundcore(void)
>  static int __init init_oss_soundcore(void)
>  {
>  	if (preclaim_oss &&
> -	    register_chrdev(SOUND_MAJOR, "sound", &soundcore_fops) == -1) {
> +	    register_chrdev(SOUND_MAJOR, "sound", &soundcore_fops) < 0) {
>  		printk(KERN_ERR "soundcore: sound device already in use.\n");
>  		return -EBUSY;
>  	}
> -- 
> 1.9.1
> 
> 

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

end of thread, other threads:[~2015-11-07 10:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-06 22:56 [PATCH] sound: fix check for error condition of register_chrdev() Alexey Khoroshilov
2015-11-07 10:15 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox