From patchwork Mon Oct 15 13:13:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 1593871 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 26A20DFB34 for ; Mon, 15 Oct 2012 13:15:46 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TNkUE-0007tq-KE; Mon, 15 Oct 2012 13:13:38 +0000 Received: from mail-we0-f177.google.com ([74.125.82.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TNkUA-0007tT-SA for linux-arm-kernel@lists.infradead.org; Mon, 15 Oct 2012 13:13:35 +0000 Received: by mail-we0-f177.google.com with SMTP id u50so3201188wey.36 for ; Mon, 15 Oct 2012 06:13:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=yGwdR0wQlfy+15N3lYm9U91rQQS8UbwRQVrmqtH90wg=; b=ccPlW6RR35Y34MWf3r8ci65S+wFCl8BNDqTzpSQsnqZnaGFK5T/fcllDktO3Lc7acf INxIdTO0S5TVeMenpgdCETi6Y1+6AOyBTSPwLXwVrVDNdcBL/8iXF3+bLruc2u2PEMv/ t9Rh+3aLuArh8TDI/I8406Y90m7hmhxNIrKjUbGG37qLjrNfLnwae170nlpjs5PqcXe9 6LOoy+Jd85hkpcW0T5lrxEtw1G1BH+eOlM2VcwTKuFjDZcsatNYoW2aRImMkH6zfN1Qk eN5asfu+vfQFgA1GUS9ZtXdN5X4wOZ2kWClyYa3P1V19HCDR8CiGdJ1ib4cv/RjoFyK9 baNQ== Received: by 10.180.77.34 with SMTP id p2mr23834633wiw.0.1350306812184; Mon, 15 Oct 2012 06:13:32 -0700 (PDT) Received: from localhost.localdomain (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id dm3sm15817436wib.3.2012.10.15.06.13.30 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 15 Oct 2012 06:13:31 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] ASoC: Ux500: Dispose of device nodes correctly Date: Mon, 15 Oct 2012 14:13:25 +0100 Message-Id: <1350306806-5688-1-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQmiPW9suvLmTe1Hrhyeti/0BwvD9GIIQDoU9PSYIXPmjC0xvZig8oXMaYe87unuL7nIguIB X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.177 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: alsa-devel@alsa-project.org, linus.walleij@stericsson.com, arnd@arndb.de, Mark Brown , Lee Jones , Liam Girdwood X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org When of_parse_phandle() is used to find a device node, its reference count is incremented by the helper. Once we're finished with them, it's our responsibly to ensure they are freed in the correct manor. Cc: alsa-devel@alsa-project.org Cc: Liam Girdwood Cc: Mark Brown Acked-by: Linus Walleij Signed-off-by: Lee Jones --- sound/soc/ux500/mop500.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sound/soc/ux500/mop500.c b/sound/soc/ux500/mop500.c index 6f67e6b..651a52a 100644 --- a/sound/soc/ux500/mop500.c +++ b/sound/soc/ux500/mop500.c @@ -57,6 +57,20 @@ static struct snd_soc_card mop500_card = { .num_links = ARRAY_SIZE(mop500_dai_links), }; +static void mop500_of_node_put(void) +{ + int i; + + for (i = 0; i < 2; i++) { + if (mop500_dai_links[i].cpu_of_node) + of_node_put((struct device_node *) + mop500_dai_links[i].cpu_of_node); + if (mop500_dai_links[i].codec_of_node) + of_node_put((struct device_node *) + mop500_dai_links[i].codec_of_node); + } +} + static int __devinit mop500_of_probe(struct platform_device *pdev, struct device_node *np) { @@ -69,6 +83,7 @@ static int __devinit mop500_of_probe(struct platform_device *pdev, if (!(msp_np[0] && msp_np[1] && codec_np)) { dev_err(&pdev->dev, "Phandle missing or invalid\n"); + mop500_of_node_put(); return -EINVAL; } @@ -83,6 +98,7 @@ static int __devinit mop500_of_probe(struct platform_device *pdev, return 0; } + static int __devinit mop500_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -128,6 +144,7 @@ static int __devexit mop500_remove(struct platform_device *pdev) snd_soc_unregister_card(mop500_card); mop500_ab8500_remove(mop500_card); + mop500_of_node_put(); return 0; }