Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1329428imm; Fri, 15 Jun 2018 15:23:52 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI28eaRJc6g229jNH9lMDosNfRDuvLkgcGXK61YybyjjDJWQM5hCTBIrv8gmYwfPnbNAKXk X-Received: by 2002:a63:7c55:: with SMTP id l21-v6mr3270078pgn.352.1529101432805; Fri, 15 Jun 2018 15:23:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529101432; cv=none; d=google.com; s=arc-20160816; b=PFeSOioJ4LWq6or9el4WopAgNFnVdaz4HzhvHL1a+2xjd/lguAcTCX9Tqsv5HfrnJS I1Ow6hD9aPqsHBTyIHfw8mtfEGXCRqu3kAzJurfnfxJ+lG+bewyiS5wXugVekBHqJ28T T9cFJB8nEhnoPuio5k1SEWgxX92P0hvnMwwmLxmBJuS2eR8DBt5z3f97wgVlPSi8eUYX xjDj3SwxJsjOL2WuLIjXo89m8PMCimcEro/guDz8T/YlMuN05r/OP9plYPPmqKw6XXEu FFkJI8hOT1oGmtHYMxLXJ9hRHs9m7zjOMQYjBKlbSB6LVTE+Y2KX3OCs+8S4QwpIQHrD vV/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=NTJIE5h+OsVDt6gssNvt6ow2ELY87H8yLSkzPtuFPOA=; b=BMMEKhSpSuwAUMORhXyp8nojBoMTTovCKrCRi/bAufZSisD9YnM6hVW02iwvQDByXe RD6NUNyUkhEi7qalPNA2OEtzRL56oEHBUNQuccOtCrRe8+FQpbD/cC9ln7SNDL/Ffr2k QuIsBbC3WNKNzzPWBQ4i5Eczotr9zqcaTJ1inynZvA0NGgcn38vMk6VrdaNqyEF6vpFr PkavxgWzunxzIAz0z2wAp2aJTcHdO4fstRYYSkIbuLlr1Tz4/3d5EQ/aoQ0a9tgvXvYh uRpU5Pc181byLc6KXf9FD54ht53j/wc3uw63WiezUznDrXXgtGdjnGw7uUL6QU4aXKSI E6bg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t66-v6si7205708pgc.6.2018.06.15.15.23.38; Fri, 15 Jun 2018 15:23:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756701AbeFOWXK (ORCPT + 99 others); Fri, 15 Jun 2018 18:23:10 -0400 Received: from mail.ispras.ru ([83.149.199.45]:52170 "EHLO mail.ispras.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756683AbeFOWXI (ORCPT ); Fri, 15 Jun 2018 18:23:08 -0400 Received: from localhost.localdomain (ppp85-140-190-130.pppoe.mtu-net.ru [85.140.190.130]) by mail.ispras.ru (Postfix) with ESMTPSA id D5271540110; Sat, 16 Jun 2018 01:23:05 +0300 (MSK) From: Alexey Khoroshilov To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: Alexey Khoroshilov , alsa-devel@alsa-project.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org, Julia Lawall , sil2review@lists.osadl.org Subject: [PATCH] ASoC: tegra: fix device_node refcounting Date: Sat, 16 Jun 2018 01:22:58 +0300 Message-Id: <1529101378-5543-1-git-send-email-khoroshilov@ispras.ru> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org tegra_rt5677_probe() gets a couple of device nodes with of_parse_phandle(), but there is no release of them. The patch adds the release to tegra_rt5677_remove() and to error handling paths in the probe. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov --- sound/soc/tegra/tegra_rt5677.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/sound/soc/tegra/tegra_rt5677.c b/sound/soc/tegra/tegra_rt5677.c index 0e4805c7b4ca..7081f15302cc 100644 --- a/sound/soc/tegra/tegra_rt5677.c +++ b/sound/soc/tegra/tegra_rt5677.c @@ -264,13 +264,13 @@ static int tegra_rt5677_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Property 'nvidia,i2s-controller' missing or invalid\n"); ret = -EINVAL; - goto err; + goto err_put_codec_of_node; } tegra_rt5677_dai.platform_of_node = tegra_rt5677_dai.cpu_of_node; ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); if (ret) - goto err; + goto err_put_cpu_of_node; ret = snd_soc_register_card(card); if (ret) { @@ -283,6 +283,13 @@ static int tegra_rt5677_probe(struct platform_device *pdev) err_fini_utils: tegra_asoc_utils_fini(&machine->util_data); +err_put_cpu_of_node: + of_node_put(tegra_rt5677_dai.cpu_of_node); + tegra_rt5677_dai.cpu_of_node = NULL; + tegra_rt5677_dai.platform_of_node = NULL; +err_put_codec_of_node: + of_node_put(tegra_rt5677_dai.codec_of_node); + tegra_rt5677_dai.codec_of_node = NULL; err: return ret; } @@ -296,6 +303,12 @@ static int tegra_rt5677_remove(struct platform_device *pdev) tegra_asoc_utils_fini(&machine->util_data); + tegra_rt5677_dai.platform_of_node = NULL; + of_node_put(tegra_rt5677_dai.codec_of_node); + tegra_rt5677_dai.codec_of_node = NULL; + of_node_put(tegra_rt5677_dai.cpu_of_node); + tegra_rt5677_dai.cpu_of_node = NULL; + return 0; } -- 2.7.4