Received: by 10.223.185.116 with SMTP id b49csp1065175wrg; Fri, 23 Feb 2018 11:16:44 -0800 (PST) X-Google-Smtp-Source: AH8x227KVdnSJdGs3MPISyUNMTDCT5tmvJj7yAD+TOw2OpGjDCfCR6O2LLX4eewyq5G7sG+wbp92 X-Received: by 2002:a17:902:7148:: with SMTP id u8-v6mr2548226plm.91.1519413404676; Fri, 23 Feb 2018 11:16:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519413404; cv=none; d=google.com; s=arc-20160816; b=ABwN9/rbVyVE9eptsgrnsJ2TS4G+ekeMSo5KR7xW/HPckvhGnW04kQpqb1DPgFsd/0 tI8pUFfITcpzVBcCpMXKPDVMpRAXb8XTk86+0lYgK+liCANNcFPSyJw+Y4/9norgj/sB +BymD7dXh7eACqMV54Z/TUUE4b0NO6vkKOqlAwrSp316ToKcp8L3zelQ2gxRrr7Qz7w8 +9k9RHzTS1md8c0Pe9lTYS1fRIJGq8z59yCvbu7V+lqSUQPFd5RHlsloY+XEDFrQIbgC FB1Kr79FSmgEFbkxQN8PWd1Rz+Z7WaLuuIs48LJyVartUILIAO/eYlKuhUO0fjA+GkyJ VAYQ== 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=w9dlSJJW6pyk6EkEzXEjibTzlvX/muRU6ITsG+F5cLI=; b=yqEjTYppxAPqe3Jr0aypqEExo5a8aUJ+8U2pa2rBfyupUTDt1zLwx42Xgc4KmIIMMs /fCNk2o6MVIuwqrc0r3lQkfmtgI/aXECtclq52aH31sINUne+ReOm6QoiHTT7iyqRYts POYEKsldHzyuTa6qlh/EFXURBo56Cme/9Nbz14eSaAtwgyeZlgRPUMUNoo6WIso5VYtK sK575VWQ92N2S1LhwwFuPgBitOsr3dBPOJFdDZduZVohB7jVaMUzxTLlJz88OQHQPKLU 2eiFXEelXqCpk6oTj28r7BuvF04BEPMdYQLkEqGKtkdVxF8SsZrHSmFVBSxVJq3o+ARC cYyA== 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 i66si1842752pgc.445.2018.02.23.11.16.30; Fri, 23 Feb 2018 11:16:44 -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 S935556AbeBWSzi (ORCPT + 99 others); Fri, 23 Feb 2018 13:55:38 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:48290 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935543AbeBWSzf (ORCPT ); Fri, 23 Feb 2018 13:55:35 -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 E095E1257; Fri, 23 Feb 2018 18:55:34 +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.14 137/159] ASoC: rockchip: disable clock on error Date: Fri, 23 Feb 2018 19:27:25 +0100 Message-Id: <20180223170759.663091447@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170743.086611315@linuxfoundation.org> References: <20180223170743.086611315@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.14-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 @@ -322,26 +322,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; @@ -373,6 +377,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; }