Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp478754pxj; Thu, 17 Jun 2021 07:08:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwV+0n2QdkMoHWyMaahXDIK9ObIMKB7docnH8+9Eg37qYFetocLnX6nlYUJzwpYQESAm2uW X-Received: by 2002:a17:906:2b4c:: with SMTP id b12mr5367647ejg.411.1623938900232; Thu, 17 Jun 2021 07:08:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623938900; cv=none; d=google.com; s=arc-20160816; b=n3bQ55/dmPmYqBdyqgMYAVLlxob+LgvOWAQwCWyqfN875JUsoymWeOgQ2/Wsikwhgd EB5dpKn3GLtLPwk5uWAB/7vhTz0jGWNtFH7qtPmSHf5bsX1LNos83RWnXfni56+hrnDm BNDoq9Ny04828t2A0H50lNZSquuWfQJij0NW/NwenfgzR807Hbxdly/WhvzvlbUDEF6z CtZDrT4vY4IGjmNX9bbXcpIJukG+q5gU01QoW4bOKN9INccLOM6RoAgtmj27UqaUxZG3 EIWi0G8aga9iEXcEY9VuHrBB3rkVvkklPu/J0YsfQX9hXb2FZnm3SwLvkBI7axEru1vH d+tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=r/Phzu7bjrEKdlhTrW87VC5bOCa9s6yypu708VamqUg=; b=sDTf0KbYGBUkeHfUFoLe6Xpl7hVR1kr/SiiJrRTRvnOQkZX64HusNHo2DHf0tNRH3E xs1EU9cWi/BSlMMO2rVFYMdJtB47YHEgKNuox7uu2zcoUR1brA9NDaiGMg3YCQNSOQRf JBLkPHmIz7SUPzVtcOsv8Sss5nZ71HpUQWWT/YYQhuNMZM5p05LOh40wguhIc2YLhqIG r/UNwYjJkDE8/cs9rOziq5s9gUMIxLhBf+oA1+qnItXSaELtpg8zXgC0OHpA6Bz0qmAl fy+Sgrp4nUv8T1yApXfRTOXiWMo8j1tVOwYAMMdUL7Pz1Om8tcUBPn3alSgW7Ol64KGB nGPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="V+/6qPue"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga21si5599377ejb.24.2021.06.17.07.07.55; Thu, 17 Jun 2021 07:08:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="V+/6qPue"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231809AbhFQMtJ (ORCPT + 99 others); Thu, 17 Jun 2021 08:49:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230473AbhFQMtI (ORCPT ); Thu, 17 Jun 2021 08:49:08 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03325C061574; Thu, 17 Jun 2021 05:47:00 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id p7so10262569lfg.4; Thu, 17 Jun 2021 05:46:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=r/Phzu7bjrEKdlhTrW87VC5bOCa9s6yypu708VamqUg=; b=V+/6qPueqNv2eJf47RZRXdqdDWmhAT08TDW/JYPs3WbJUN3ProYHLkncBwwYYvVgQk ncY12AUH2y595XbeaUoSWEGzYEDRrNOpRFSG7TwtgsQf2Pi3fpkX9WVo6nf0v3BsL7g3 YGsAUS60HJeqGjljrduvog3/kAZMxfPxh8n+lszzDVJKwgddGlZzYDmPrgewCAAQTmMl KuXr9W/egmqV61kGkuGcAHJv1e7PXbRcZ83Wmag1khtx//vfgWwCCXnWehtf1vD8ukTP 09XVvNo5/XVKZrG8+J1GFV5hpV1unHSiGPxpFXnsh1YiEyjyqosAJa0DDFu1aKDQQpDc db1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=r/Phzu7bjrEKdlhTrW87VC5bOCa9s6yypu708VamqUg=; b=OUudUxbdHVeQLe0WzY5zhjAFXVJspq5T0+09jhIvhHmZXajHJhuj8HNObjHD+/bGEg eYUTN/bfQIKcb4mkiECYxQ+QHDOiBvZT6Cj0B5GJiWuxij7a4Gx0HjgzvvBL3tRRxJpd eRecf3PeXR97zbggi8bCEiHWMq7BGgwBafzmzR0SZqrALl26cmgbH6L7ehTIcua4Nf9i u+YClzMydCgXxAJLvAwkpVZ73fmS4v6eNQEwt+n09+BM7YqDp8CadQaqNlCKGcNMNXTE FCorxzB3szdbJJE+arcHtbw2ozGUyAan0Q7XyzZGhCJDswbvgqGjfqBCTfi8QImEXAvy Qo2Q== X-Gm-Message-State: AOAM532uuu0KxgbpbXwLymyR2Lzu6ROPuFyaVCjwKIwXfmUzuC3/XL0x Vq9Ogp6gzmjw9KhWIVPX1wYYqhkmQYw= X-Received: by 2002:a19:a407:: with SMTP id q7mr3870181lfc.68.1623934018213; Thu, 17 Jun 2021 05:46:58 -0700 (PDT) Received: from [192.168.2.145] (94-29-29-31.dynamic.spd-mgts.ru. [94.29.29.31]) by smtp.googlemail.com with ESMTPSA id m22sm719848ljj.45.2021.06.17.05.46.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Jun 2021 05:46:57 -0700 (PDT) Subject: Re: [PATCH -next] ASoC: tegra: Fix missing clk_disable_unprepare() on error path To: Zou Wei , lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, thierry.reding@gmail.com, jonathanh@nvidia.com Cc: linux-tegra@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org References: <1623929439-4289-1-git-send-email-zou_wei@huawei.com> From: Dmitry Osipenko Message-ID: Date: Thu, 17 Jun 2021 15:46:57 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <1623929439-4289-1-git-send-email-zou_wei@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 17.06.2021 14:30, Zou Wei пишет: > Fix the missing clk_disable_unprepare() before return > from tegra_machine_hw_params() in the error handling case. > > Reported-by: Hulk Robot > Signed-off-by: Zou Wei > --- > sound/soc/tegra/tegra_asoc_machine.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/sound/soc/tegra/tegra_asoc_machine.c b/sound/soc/tegra/tegra_asoc_machine.c > index a53aec3..397f326 100644 > --- a/sound/soc/tegra/tegra_asoc_machine.c > +++ b/sound/soc/tegra/tegra_asoc_machine.c > @@ -306,6 +306,7 @@ static int tegra_machine_hw_params(struct snd_pcm_substream *substream, > > err = snd_soc_dai_set_sysclk(codec_dai, clk_id, mclk, SND_SOC_CLOCK_IN); > if (err < 0) { > + clk_disable_unprepare(machine->clk_cdev1); It should be the opposite, the clock must be enabled here and it could be re-enabled in the other error cases. In practice the chance of those errors is close to zero, so we don't care about them since we will have much bigger problems in that case. > dev_err(card->dev, "codec_dai clock not set: %d\n", err); > return err; > } > @@ -523,8 +524,10 @@ int tegra_asoc_machine_probe(struct platform_device *pdev) > } > > err = devm_snd_soc_register_card(dev, card); > - if (err) > + if (err) { > + clk_disable_unprepare(machine->clk_cdev1); We also don't disable clock after removing driver module. This is intentional because that clock is enabled to workaround obscure bug on one of devboards that I can't reproduce. Ideally we should should fix the bug and remove the clk-enable hack. So I'm not sure whether this is a worthwhile "fix".