From: Takashi Iwai Subject: Re: [patch] remove unnecessary null check Date: Wed, 18 Nov 2009 10:00:19 +0100 Message-ID: References: Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (cantor.suse.de [195.135.220.2]) by alsa0.perex.cz (Postfix) with ESMTP id 8AC93103803 for ; Wed, 18 Nov 2009 10:00:19 +0100 (CET) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Dan Carpenter Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Wed, 18 Nov 2009 10:31:57 +0200 (SAST), Dan Carpenter wrote: > > This function is only called from snd_ctl_ioctl() and the file parameter > can never be null so there is no need to check it here. > > We dereference file at the start of the function: > struct snd_card *card = file->card; > and it confuses static checkers to dereference a pointer before > checking it. > > regards, > dan carpenter > > Signed-off-by: Dan Carpenter Thanks, applied now. Takashi > > --- orig/sound/core/control.c 2009-11-17 07:15:04.000000000 +0200 > +++ devel/sound/core/control.c 2009-11-17 07:40:30.000000000 +0200 > @@ -1120,7 +1120,7 @@ > goto __kctl_end; > } > if (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) { > - if (file && vd->owner != NULL && vd->owner != file) { > + if (vd->owner != NULL && vd->owner != file) { > err = -EPERM; > goto __kctl_end; > } >