Received: by 10.223.185.116 with SMTP id b49csp1097522wrg; Fri, 23 Feb 2018 11:53:57 -0800 (PST) X-Google-Smtp-Source: AH8x226jymnaSsewOcQnnljhJkrP8IUAQSTV+mLxYoISRne4JGNqj+ZdcJdqvpydZTF5r9U8O9FV X-Received: by 10.98.156.16 with SMTP id f16mr2850292pfe.180.1519415637402; Fri, 23 Feb 2018 11:53:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519415637; cv=none; d=google.com; s=arc-20160816; b=0z03t8xrtwKoV4McT+ddrJEoFTqC3/P4NjnBfoTwfXPzE2jgkdrsOTRhXyxb3j1A5S 2z+1VRLuSKO9P/LXgu6RsMZEC26dyDpOHdbLqbP8cgN1IhRduX3mG+mj2f+RgPQtLzor AA+05KABka4SOuoivX8dpxxLmr+OWYv9YcdKCWAFlfK8hDZRMruipGauezlKL14dAkBY Z0gywIW+4EyOe53vB9T+zHm2e2AzFeGRaFBWpt02/Dpzoi5ZAbFjsVzj07WZRM+WrBrw c6BZdgH/0rOlXf6pndd9KXGB4nlqt9MhS4Ix9FcMcw4tJAXqiiArwHecrp3tYGxuQBCC j4hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Ea96xClJDIDaGkZza9l5/V0vdegf6nvCZHeE9omklKc=; b=Z9Q/DiChlMeEvhpCjTYPnVk14MP6icIYnxWddF7imUTl1aiK/CJ0JJDIhRnXfQ9Msy 0RMXsMux1H85QkSRhmuPXLZP77nTqxsO26//jYpilEhU9dtaPBGL2Cjl9iHyL12KMLGv wbjJGPC68buPolR3VjS+EO+gFk3xR3rKUZTnN5CY5p5Y4UbP96O5ZprM5MJ+kcGJCTV/ ztzyob4prEIRn+GtbqbTGs9yXOqVMEHQiXl3w6RiSSyq67n1Scvf72JmGB4JLvmTNzXH Yg1F3m3MvHBZ0AoEWyHAe2JcpcECS95AkXPGZjuN2uxHfN6ternHdLMuEGDZOnU4SN/o yyPg== 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 q4si1890579pgr.386.2018.02.23.11.53.43; Fri, 23 Feb 2018 11:53:57 -0800 (PST) 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 S1754956AbeBWTxA (ORCPT + 99 others); Fri, 23 Feb 2018 14:53:00 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:43394 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933330AbeBWSpg (ORCPT ); Fri, 23 Feb 2018 13:45:36 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 9E8FA128B; Fri, 23 Feb 2018 18:45:35 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Potyra , Mark Brown , Sasha Levin Subject: [PATCH 4.9 075/145] ASoC: rockchip: disable clock on error Date: Fri, 23 Feb 2018 19:26:21 +0100 Message-Id: <20180223170734.417523447@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170724.669759283@linuxfoundation.org> References: <20180223170724.669759283@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stefan Potyra [ Upstream commit c7b92172a61b91936be985cb9bc499a4ebc6489b ] Disable the clocks in rk_spdif_probe when an error occurs after one of the clocks has been enabled previously. Found by Linux Driver Verification project (linuxtesting.org). Fixes: f874b80e1571 ASoC: rockchip: Add rockchip SPDIF transceiver driver Signed-off-by: Stefan Potyra Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- sound/soc/rockchip/rockchip_spdif.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) --- a/sound/soc/rockchip/rockchip_spdif.c +++ b/sound/soc/rockchip/rockchip_spdif.c @@ -318,26 +318,30 @@ static int rk_spdif_probe(struct platfor spdif->mclk = devm_clk_get(&pdev->dev, "mclk"); if (IS_ERR(spdif->mclk)) { dev_err(&pdev->dev, "Can't retrieve rk_spdif master clock\n"); - return PTR_ERR(spdif->mclk); + ret = PTR_ERR(spdif->mclk); + goto err_disable_hclk; } ret = clk_prepare_enable(spdif->mclk); if (ret) { dev_err(spdif->dev, "clock enable failed %d\n", ret); - return ret; + goto err_disable_clocks; } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(regs)) - return PTR_ERR(regs); + if (IS_ERR(regs)) { + ret = PTR_ERR(regs); + goto err_disable_clocks; + } spdif->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "hclk", regs, &rk_spdif_regmap_config); if (IS_ERR(spdif->regmap)) { dev_err(&pdev->dev, "Failed to initialise managed register map\n"); - return PTR_ERR(spdif->regmap); + ret = PTR_ERR(spdif->regmap); + goto err_disable_clocks; } spdif->playback_dma_data.addr = res->start + SPDIF_SMPDR; @@ -369,6 +373,10 @@ static int rk_spdif_probe(struct platfor err_pm_runtime: pm_runtime_disable(&pdev->dev); +err_disable_clocks: + clk_disable_unprepare(spdif->mclk); +err_disable_hclk: + clk_disable_unprepare(spdif->hclk); return ret; }