From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752029Ab1HTHaU (ORCPT ); Sat, 20 Aug 2011 03:30:20 -0400 Received: from cantor2.suse.de ([195.135.220.15]:47571 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751153Ab1HTHaS (ORCPT ); Sat, 20 Aug 2011 03:30:18 -0400 Date: Sat, 20 Aug 2011 09:30:14 +0200 Message-ID: From: Takashi Iwai To: Julia Lawall Cc: Johannes Berg , kernel-janitors@vger.kernel.org, Jaroslav Kysela , Grant Likely , linuxppc-dev@lists.ozlabs.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, devicetree-discuss@lists.ozlabs.org Subject: Re: [PATCH 4/4] sound/aoa/fabrics/layout.c: remove unneeded kfree In-Reply-To: <1313820761-12042-4-git-send-email-julia@diku.dk> References: <1313820761-12042-4-git-send-email-julia@diku.dk> User-Agent: Wanderlust/2.15.6 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.7 Emacs/23.3 (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 At Sat, 20 Aug 2011 08:12:41 +0200, Julia Lawall wrote: > > From: Julia Lawall > > The label outnodev is only used when kzalloc has not yet taken place or has > failed, so there is no need for the call for kfree under this label. > > A simplified version of the semantic match that finds this problem is as > follows: (http://coccinelle.lip6.fr/) > > // > @@ > identifier x; > expression E1!=0,E2,E3,E4; > statement S; > iterator I; > @@ > > ( > if (...) { ... when != kfree(x) > when != x = E3 > when != E3 = x > * return ...; > } > ... when != x = E2 > when != I(...,x,...) S > if (...) { ... when != x = E4 > kfree(x); ... return ...; } > ) > // > > Signed-off-by: Julia Lawall Thanks, applied this one. The rest three are left for review by Mark & Liam. Takashi > --- > sound/aoa/fabrics/layout.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sound/aoa/fabrics/layout.c b/sound/aoa/fabrics/layout.c > index 3fd1a7e..552b97a 100644 > --- a/sound/aoa/fabrics/layout.c > +++ b/sound/aoa/fabrics/layout.c > @@ -1073,10 +1073,10 @@ static int aoa_fabric_layout_probe(struct soundbus_dev *sdev) > sdev->pcmid = -1; > list_del(&ldev->list); > layouts_list_items--; > + kfree(ldev); > outnodev: > of_node_put(sound); > layout_device = NULL; > - kfree(ldev); > return -ENODEV; > } > >