X-GM-THRID: 6249584432757342208 X-Received: by 10.129.3.69 with SMTP id 66mr45627301ywd.41.1455248675843; Thu, 11 Feb 2016 19:44:35 -0800 (PST) X-BeenThere: outreachy-kernel@googlegroups.com Received: by 10.182.33.34 with SMTP id o2ls708933obi.70.gmail; Thu, 11 Feb 2016 19:44:35 -0800 (PST) X-Received: by 10.182.199.70 with SMTP id ji6mr45965028obc.32.1455248675482; Thu, 11 Feb 2016 19:44:35 -0800 (PST) Return-Path: Received: from mail.linuxfoundation.org (mail.linuxfoundation.org. [140.211.169.12]) by gmr-mx.google.com with ESMTPS id 12si1175333pfb.1.2016.02.11.19.44.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Feb 2016 19:44:35 -0800 (PST) Received-SPF: pass (google.com: domain of gregkh@linuxfoundation.org designates 140.211.169.12 as permitted sender) client-ip=140.211.169.12; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of gregkh@linuxfoundation.org designates 140.211.169.12 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Received: from localhost (c-50-170-35-168.hsd1.wa.comcast.net [50.170.35.168]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 36B021019; Fri, 12 Feb 2016 03:44:35 +0000 (UTC) Date: Thu, 11 Feb 2016 19:44:34 -0800 From: Greg KH To: Amitoj Kaur Chawla Cc: outreachy-kernel@googlegroups.com Subject: Re: [Outreachy kernel] [PATCH 3/6] staging: comedi: comedi_fops: Remove useless statements Message-ID: <20160212034434.GC12182@kroah.com> References: <20160210085922.GA14616@amitoj-Inspiron-3542> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160210085922.GA14616@amitoj-Inspiron-3542> User-Agent: Mutt/1.5.24 (2015-08-30) On Wed, Feb 10, 2016 at 02:29:22PM +0530, Amitoj Kaur Chawla wrote: > Drop if conditions that have an unrequired return in a void function. > > Found using Coccinelle. The semantic patch used to find this is as > follows: > > // > @@ > statement S; > expression e,x; > @@ > > * if(e) > ( > { ... return ...; } > & > S > ) > > * if(x) > ( > { ... return ...; } > & > S > ) > // > > Signed-off-by: Amitoj Kaur Chawla > --- > drivers/staging/comedi/comedi_fops.c | 6 ------ > 1 file changed, 6 deletions(-) > > diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c > index d6bcf73..35e79d7 100644 > --- a/drivers/staging/comedi/comedi_fops.c > +++ b/drivers/staging/comedi/comedi_fops.c > @@ -2811,12 +2811,6 @@ void comedi_free_subdevice_minor(struct comedi_subdevice *s) > { > unsigned int i; > > - if (!s) > - return; > - if (s->minor < COMEDI_NUM_BOARD_MINORS || > - s->minor >= COMEDI_NUM_MINORS) > - return; > - And you just crashed the kernel :( not good... Please be more careful. greg k-h