Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1265576imm; Fri, 27 Jul 2018 14:09:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf9uOQWP/VI3v6sH/ZQ+o+SYiUwjM1Ufy4prkSIYxPiubA3c0eiA/USzK0fIm8gMG7imM9F X-Received: by 2002:a65:40ca:: with SMTP id u10-v6mr7325757pgp.2.1532725793704; Fri, 27 Jul 2018 14:09:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532725793; cv=none; d=google.com; s=arc-20160816; b=oOUKFf8/AWJF+nU88TuQZh7kj44xcWA+1qhX3eDBjd4TN8M4JPv/T4eITtcdTuuAjv F6S9nbYgs+j0ioDQkJH1viIUiDcF04uPyMRzeuFlfzU/wzQlvuHyghW3HrZh/cq+rrXX reb6Z/d5nn1Fg5k2HrhrU6x9pt5IH72KJUzx0x7r2E9k0VdkYo0ybCrcVlR5bUVodj7L mRHdLyuHmdOruaE99bbhLZbJbzmCGuOxFuufPJhLQsT1Al1H9HRboCL+jmOOIM8X3J03 hnd/t7OYnuEAE5BM0hmShvyyg8miSQVfMXIJEhm/kRs7gK/lrZ+e/C2Ovi4T80ASLj2v WO+A== 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=u6M1q2oJ30CrMIUj1Ii/LAtGbi/KSqZd9ngi1cgollM=; b=Ws+N0v4Wx2FYmdSeMBkQfuUc1+OuKohyIjS/TuFWCvffwNzBrleQMRMIKuZguuQ3W3 cQ+r1ud+a8C7TuVxXY6eoW+UydQU0ZKyQ+mIeC/9J9LmA0MulObWK5xKbnfD+SRLE/0D 3jpbK7HRdOFTTKunVNXR/5K8CbCOk8pF2DdvCn/V6HUJ8SEGmJyHgZ/Jeeww6YWOVCxO k2zjdB3GONihWBlGXVocvj3JQoqfATIKY62KZlAEKXarqL9pEu4yBSMWZActYP4EvOPX zaA1PSkHIKwvb6IEINyUn0jumrBOheRDnV/MBgNhCY9zYe61IYFr19Oo3Q6pD5UH2rSN nL2g== 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 i64-v6si4194917pli.431.2018.07.27.14.09.38; Fri, 27 Jul 2018 14:09:53 -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 S2389671AbeG0Wa5 (ORCPT + 99 others); Fri, 27 Jul 2018 18:30:57 -0400 Received: from mail.ispras.ru ([83.149.199.45]:52938 "EHLO mail.ispras.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389317AbeG0Wa5 (ORCPT ); Fri, 27 Jul 2018 18:30:57 -0400 Received: from localhost.localdomain (ppp85-140-182-137.pppoe.mtu-net.ru [85.140.182.137]) by mail.ispras.ru (Postfix) with ESMTPSA id 6CB3F54006B; Sat, 28 Jul 2018 00:07:15 +0300 (MSK) From: Alexey Khoroshilov To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: Alexey Khoroshilov , linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Subject: [PATCH] ASoC: tegra_alc5632: fix device_node refcounting Date: Sat, 28 Jul 2018 00:06:59 +0300 Message-Id: <1532725619-8775-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_alc5632_probe() increments reference count of device nodes with of_parse_phandle(), but there is no code decrementing them in the driver. The patch adds of_node_put() to tegra_alc5632_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_alc5632.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/sound/soc/tegra/tegra_alc5632.c b/sound/soc/tegra/tegra_alc5632.c index 5197d6b18cb6..98d87801d57a 100644 --- a/sound/soc/tegra/tegra_alc5632.c +++ b/sound/soc/tegra/tegra_alc5632.c @@ -190,14 +190,14 @@ static int tegra_alc5632_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_alc5632_dai.platform_of_node = tegra_alc5632_dai.cpu_of_node; ret = tegra_asoc_utils_init(&alc5632->util_data, &pdev->dev); if (ret) - goto err; + goto err_put_cpu_of_node; ret = snd_soc_register_card(card); if (ret) { @@ -210,6 +210,13 @@ static int tegra_alc5632_probe(struct platform_device *pdev) err_fini_utils: tegra_asoc_utils_fini(&alc5632->util_data); +err_put_cpu_of_node: + of_node_put(tegra_alc5632_dai.cpu_of_node); + tegra_alc5632_dai.cpu_of_node = NULL; + tegra_alc5632_dai.platform_of_node = NULL; +err_put_codec_of_node: + of_node_put(tegra_alc5632_dai.codec_of_node); + tegra_alc5632_dai.codec_of_node = NULL; err: return ret; } @@ -223,6 +230,12 @@ static int tegra_alc5632_remove(struct platform_device *pdev) tegra_asoc_utils_fini(&machine->util_data); + of_node_put(tegra_alc5632_dai.cpu_of_node); + tegra_alc5632_dai.cpu_of_node = NULL; + tegra_alc5632_dai.platform_of_node = NULL; + of_node_put(tegra_alc5632_dai.codec_of_node); + tegra_alc5632_dai.codec_of_node = NULL; + return 0; } -- 2.7.4