Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752261AbdHBIXE (ORCPT ); Wed, 2 Aug 2017 04:23:04 -0400 Received: from mail-it0-f43.google.com ([209.85.214.43]:35248 "EHLO mail-it0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751295AbdHBIXB (ORCPT ); Wed, 2 Aug 2017 04:23:01 -0400 MIME-Version: 1.0 In-Reply-To: <1500149266-32357-9-git-send-email-Julia.Lawall@lip6.fr> References: <1500149266-32357-1-git-send-email-Julia.Lawall@lip6.fr> <1500149266-32357-9-git-send-email-Julia.Lawall@lip6.fr> From: Linus Walleij Date: Wed, 2 Aug 2017 10:23:00 +0200 Message-ID: Subject: Re: [PATCH 08/11] ata: Drop unnecessary static To: Julia Lawall Cc: Kees Cook , kernel-janitors@vger.kernel.org, Tejun Heo , linux-ide@vger.kernel.org, "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 699 Lines: 37 On Sat, Jul 15, 2017 at 10:07 PM, Julia Lawall wrote: > Drop static on a local variable, when the variable is initialized before > any possible use. Thus, the static has no benefit. > > The semantic patch that fixes this problem is as follows: > (http://coccinelle.lip6.fr/) > > // > @bad exists@ > position p; > identifier x; > type T; > @@ > static T x@p; > ... > x = <+...x...+> > > @@ > identifier x; > expression e; > type T; > position p != bad.p; > @@ > -static > T x@p; > ... when != x > when strict > ?x = e; > // > > Signed-off-by: Julia Lawall Acked-by: Linus Walleij Yours, Linus Walleij