From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751940AbbKGKPI (ORCPT ); Sat, 7 Nov 2015 05:15:08 -0500 Received: from mx2.suse.de ([195.135.220.15]:52436 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751093AbbKGKPF (ORCPT ); Sat, 7 Nov 2015 05:15:05 -0500 Date: Sat, 07 Nov 2015 11:15:02 +0100 Message-ID: From: Takashi Iwai To: "Alexey Khoroshilov" Cc: "Jaroslav Kysela" , , , Subject: Re: [PATCH] sound: fix check for error condition of register_chrdev() In-Reply-To: <1446850565-8451-1-git-send-email-khoroshilov@ispras.ru> References: <1446850565-8451-1-git-send-email-khoroshilov@ispras.ru> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.5 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 > >