Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1264636 > unrolled thread

[PATCH] sound: fix check for error condition of register_chrdev()

Started byAlexey Khoroshilov <khoroshilov@ispras.ru>
First post2015-11-07 00:00 +0100
Last post2015-11-07 11:20 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] sound: fix check for error condition of register_chrdev() Alexey Khoroshilov <khoroshilov@ispras.ru> - 2015-11-07 00:00 +0100
    Re: [PATCH] sound: fix check for error condition of register_chrdev() Takashi Iwai <tiwai@suse.de> - 2015-11-07 11:20 +0100

#1264636 — [PATCH] sound: fix check for error condition of register_chrdev()

FromAlexey Khoroshilov <khoroshilov@ispras.ru>
Date2015-11-07 00:00 +0100
Subject[PATCH] sound: fix check for error condition of register_chrdev()
Message-ID<qrY9c-2ke-7@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1264800

FromTakashi Iwai <tiwai@suse.de>
Date2015-11-07 11:20 +0100
Message-ID<qs8Lf-XB-11@gated-at.bofh.it>
In reply to#1264636
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
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web