Received: by 10.223.185.116 with SMTP id b49csp1137757wrg; Fri, 23 Feb 2018 12:36:05 -0800 (PST) X-Google-Smtp-Source: AH8x224fTu5dVLeWNbNmwmNevmrcyeIg30UUddc3IMyuaQHvu9ZH5LQWdX73o3LmS8zhfyw9+VAP X-Received: by 2002:a17:902:b7c2:: with SMTP id v2-v6mr2768246plz.351.1519418164920; Fri, 23 Feb 2018 12:36:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519418164; cv=none; d=google.com; s=arc-20160816; b=EvR8BA5j+ZukJoMi05FKWfGTjWBibVfoiq9D/uP4pn59HUfwhLQ/e394FL623+AxXg ScDZLP5o5DKWpdtSb9+npET2FXJzz8hOtiFzfkls3uvg+pMd8q1maGA/L1CUP0Hh6Z8m 6uOaZDeDt3C/blAp4NcNqdQ+l8vmUBMxXwsAb4ZGvSxQTS6pvFOjB/dAEZrCbMBbN2TG MEZfNrHdvzkk3cDcGDJYe4bXwX7Bi7r58/0WjTbKo/fhm7EAZecK8om72NU+HGqvOquT dR+n3gEfvP/hhX0ZV5vtLUji1xtwq+UD2Ujv4ASOTTyNIi9s91byXz972OGFc5rjwWAi CUwg== 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=6GYVm/DGCe/4L/Mr9aVnY2YNGPuExYGyFrAXIBW46fE=; b=QWRbMT+skW9r5KvhCC6J/Vl+z8r82B+JXWMVQonwYc9glrl9hIj5cafPJdEs0RChwo f7mllLyMraBrTZ+12oVNtTXiMtWL3MRNaQbbZw6GZ3qMftjRywkPOElHHWvSVMSfq6+Z dCp5tI1GnRbvl3ur9pM2xc1a313JGzcg9ER3Ed6BGwMKN17xppNr4wyJf7GTSaHp9xwa X5jGypUaFedAzt939qYIQ7M+hj6b/nvVsg/nW7FNI108VTeMrrEktXEUPZJn/LtqDgUy 3nipbk7pv2ARhn6FMjwYbej8VEFVNgIcNvKgYv4wqgC88eN+kC31QsGu1VpZ8y2jbZAO wWPw== 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 g207si2329145pfb.320.2018.02.23.12.35.50; Fri, 23 Feb 2018 12:36:04 -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 S1753720AbeBWSfF (ORCPT + 99 others); Fri, 23 Feb 2018 13:35:05 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:37158 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753662AbeBWSfD (ORCPT ); Fri, 23 Feb 2018 13:35:03 -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 04B2E1286; Fri, 23 Feb 2018 18:35:02 +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.4 053/193] ASoC: rockchip: disable clock on error Date: Fri, 23 Feb 2018 19:24:46 +0100 Message-Id: <20180223170334.317541368@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170325.997716448@linuxfoundation.org> References: <20180223170325.997716448@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.4-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 @@ -316,26 +316,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; @@ -367,6 +371,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; }