From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965937AbbBDNQh (ORCPT ); Wed, 4 Feb 2015 08:16:37 -0500 Received: from hofr.at ([212.69.189.236]:35929 "EHLO mail.hofr.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965255AbbBDNQg (ORCPT ); Wed, 4 Feb 2015 08:16:36 -0500 Date: Wed, 4 Feb 2015 14:16:33 +0100 From: Nicholas Mc Guire To: Dan Carpenter Cc: Nicholas Mc Guire , Greg Kroah-Hartman , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Abel Moyo , Larry Finger Subject: Re: [PATCH] staging: rtl8188eu: core: switch with redundant cases Message-ID: <20150204131633.GA23913@opentech.at> References: <1423047878-5783-1-git-send-email-hofrat@osadl.org> <20150204114324.GB5336@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150204114324.GB5336@mwanda> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 04 Feb 2015, Dan Carpenter wrote: > Btw, what tool are you using to find these? > working on a set of coccinell scripts - they are not yet really clean - but this one is simply: virtual context virtual patch virtual org virtual report @assign@ position p; statement S1; @@ <+... * if@p (...) S1 else S1 ...+> @script:python@ p << assign.p; @@ print "%s:%s WARNING: condition with no effect" % (p[0].file,p[0].line) I guess this is not wildly impressive - but it seems to be effective in finding a lot of broken code. The rate of false postivs has been supprisingly low (very few case of intentional if==else like in ./fs/kernfs/file.c:661 - which is nicely documented) thx! hofrat