Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3835017imm; Mon, 18 Jun 2018 05:01:41 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIx7wkPcZsz22/ud/EuErL3sOVf1VtiXhdMy9+EdziJNy1UUkDD1SVoSX0AQPfFIlmZE7Pb X-Received: by 2002:a17:902:b217:: with SMTP id t23-v6mr13886496plr.312.1529323301129; Mon, 18 Jun 2018 05:01:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529323301; cv=none; d=google.com; s=arc-20160816; b=xgoEK4uq5gbDo4O5GlZALKpuEljUgQLMyJ4p5Ikj54i2cfiyRnPdbS7R0rvOID+Q55 sXsCvLeo8Ggldf9afjxvRCzE0RlfcWnkAsr7JPrkwGGzHargY1dUuiZDX7pyG3K8lqyZ EIFcZtHFGk9LLoPwvPL1RZFxG37gTV3tDZgy84HGbVLOQjKvd9oChL5+P0oru6aIQzvI VOPtQTgLLN0wUlHnZT4cX+8KAuZk4OwbveCUcxtPuSb+Yy+rHljFNHGahp4eLaEMgHWY pdefYSghVPeEeWq6ajeFlhwJdttcoTg1kVoHApwEKsLx9Ord1zu0oA2w6JcoEtRYvjFn XyBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=cODi900G5xOZ0pXRFs7Lle3IzqrbKHVoAbh19dn8oYo=; b=OzN8mUgxOXxwbQY4ckUY3FFhS8fz7jza0RuK7oVVZuzoq+GJ+mLJC+CQeSRtgVnVCt dhN4hrV8qOiqHo2LYat5VDpjVm0m2ypTyVEa+VoMP2uZIfb4eKbLg+aZZs6pnWIIk9QW 5EyEWrQRzgzWldDW3AiqsAidhGyuqAReeijYsr02zoop815N3TXOraPLvRXvSU15Jfyn SsQSjXxFuIW6JgLv79AYv2h7xjthsp6BkMAL+q6VYyKzDZ4n3IYQs/IDshRwONlIhZKi 4YiZcLqbcTw1GYhfFDaWcF7JD6xkNMHcnRofD7vs5uBwnSfEQPDYnfIJ3d6yXb4RwMhI HQgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=FJYs9Nsu; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w135-v6si4996654pff.18.2018.06.18.05.01.27; Mon, 18 Jun 2018 05:01:41 -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; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=FJYs9Nsu; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934976AbeFRMAf (ORCPT + 99 others); Mon, 18 Jun 2018 08:00:35 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:46026 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934931AbeFRMAc (ORCPT ); Mon, 18 Jun 2018 08:00:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=cODi900G5xOZ0pXRFs7Lle3IzqrbKHVoAbh19dn8oYo=; b=FJYs9NsuyDX3 VK/951n25ukAnIfvtLLN1lir0XtqOQF/UA8TgMuJuj++X700eLAERP5YWaxoziMqf0niEVqsPgb+h kwb+1KqCzQhol8NQL5wRqwCYY++F/37SQzHZmAb3brcVMVUNF/1iaIuXaIG/bHpXKUFNvLgDaG6O2 G4pyY=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1fUspa-0007yo-MX; Mon, 18 Jun 2018 12:00:22 +0000 Received: from broonie by debutante with local (Exim 4.91) (envelope-from ) id 1fUspa-0000EU-8H; Mon, 18 Jun 2018 13:00:22 +0100 From: Mark Brown To: Alexey Khoroshilov Cc: Mark Brown , Liam Girdwood , Mark Brown , ldv-project@linuxtesting.org, alsa-devel@alsa-project.org, Heiko Stuebner , Julia Lawall , linux-kernel@vger.kernel.org, Takashi Iwai , linux-rockchip@lists.infradead.org, sil2review@lists.osadl.org, alsa-devel@alsa-project.org Subject: Applied "ASoC: rockchip: put device_node on remove" to the asoc tree In-Reply-To: <1528582854-8402-1-git-send-email-khoroshilov@ispras.ru> Message-Id: Date: Mon, 18 Jun 2018 13:00:22 +0100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch ASoC: rockchip: put device_node on remove has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From a56df73ba5960848f60f609c68770d2638bf1dd5 Mon Sep 17 00:00:00 2001 From: Alexey Khoroshilov Date: Sun, 10 Jun 2018 01:20:54 +0300 Subject: [PATCH] ASoC: rockchip: put device_node on remove snd_rk_mc_probe() gets a couple of device nodes with of_parse_phandle(), but there is no release of them. The patch adds remove handler and proper error handling in the probe. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov Signed-off-by: Mark Brown --- sound/soc/rockchip/rockchip_rt5645.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/sound/soc/rockchip/rockchip_rt5645.c b/sound/soc/rockchip/rockchip_rt5645.c index 4db4fd56db35..881c32498808 100644 --- a/sound/soc/rockchip/rockchip_rt5645.c +++ b/sound/soc/rockchip/rockchip_rt5645.c @@ -181,7 +181,8 @@ static int snd_rk_mc_probe(struct platform_device *pdev) if (!rk_dailink.cpu_of_node) { dev_err(&pdev->dev, "Property 'rockchip,i2s-controller' missing or invalid\n"); - return -EINVAL; + ret = -EINVAL; + goto put_codec_of_node; } rk_dailink.platform_of_node = rk_dailink.cpu_of_node; @@ -190,17 +191,36 @@ static int snd_rk_mc_probe(struct platform_device *pdev) if (ret) { dev_err(&pdev->dev, "Soc parse card name failed %d\n", ret); - return ret; + goto put_cpu_of_node; } ret = devm_snd_soc_register_card(&pdev->dev, card); if (ret) { dev_err(&pdev->dev, "Soc register card failed %d\n", ret); - return ret; + goto put_cpu_of_node; } return ret; + +put_cpu_of_node: + of_node_put(rk_dailink.cpu_of_node); + rk_dailink.cpu_of_node = NULL; +put_codec_of_node: + of_node_put(rk_dailink.codec_of_node); + rk_dailink.codec_of_node = NULL; + + return ret; +} + +static int snd_rk_mc_remove(struct platform_device *pdev) +{ + of_node_put(rk_dailink.cpu_of_node); + rk_dailink.cpu_of_node = NULL; + of_node_put(rk_dailink.codec_of_node); + rk_dailink.codec_of_node = NULL; + + return 0; } static const struct of_device_id rockchip_rt5645_of_match[] = { @@ -212,6 +232,7 @@ MODULE_DEVICE_TABLE(of, rockchip_rt5645_of_match); static struct platform_driver snd_rk_mc_driver = { .probe = snd_rk_mc_probe, + .remove = snd_rk_mc_remove, .driver = { .name = DRV_NAME, .pm = &snd_soc_pm_ops, -- 2.17.1