From patchwork Fri Aug 8 10:07:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 4694901 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9097FC0338 for ; Fri, 8 Aug 2014 10:11:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D3305201BA for ; Fri, 8 Aug 2014 10:11:37 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id D96F5201B4 for ; Fri, 8 Aug 2014 10:11:36 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id D626B26551C; Fri, 8 Aug 2014 12:11:28 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 763F2265522; Fri, 8 Aug 2014 12:11:18 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 911D7265525; Fri, 8 Aug 2014 12:11:17 +0200 (CEST) Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by alsa0.perex.cz (Postfix) with ESMTP id 677822654FA for ; Fri, 8 Aug 2014 12:11:10 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.01,824,1400018400"; d="scan'208";a="88704756" Received: from palace.lip6.fr (HELO localhost.localdomain) ([132.227.105.202]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 08 Aug 2014 12:11:09 +0200 From: Julia Lawall To: Liam Girdwood Date: Fri, 8 Aug 2014 12:07:49 +0200 Message-Id: <1407492475-26283-8-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.8.3.2 MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Takashi Iwai , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Subject: [alsa-devel] =?utf-8?q?=5BPATCH_8/14=5D_ASoC=3A_rsnd=3A_delete_un?= =?utf-8?q?needed_test_before_of=5Fnode=5Fput?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Julia Lawall Of_node_put supports NULL as its argument, so the initial test is not necessary. Suggested by Uwe Kleine-König. The semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression e; @@ -if (e) of_node_put(e); // Signed-off-by: Julia Lawall --- sound/soc/sh/rcar/core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 19f7896..1922ec5 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -798,10 +798,8 @@ if (name##_node) { \ mod_parse(src); mod_parse(dvc); - if (playback) - of_node_put(playback); - if (capture) - of_node_put(capture); + of_node_put(playback); + of_node_put(capture); } dai_i++;