sound: fix check for error condition of register_chrdev()
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Fri, 6 Nov 2015 22:56:05 +0000 (01:56 +0300)
committerTakashi Iwai <tiwai@suse.de>
Sat, 7 Nov 2015 10:14:30 +0000 (11:14 +0100)
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>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/sound_core.c

index 11e953a..99b73c6 100644 (file)
@@ -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;
        }