Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13474782ybl; Sun, 29 Dec 2019 12:47:42 -0800 (PST) X-Google-Smtp-Source: APXvYqztcqnYXbLpfB1ZqGEhBsdPhob52U8gjqzW4QJpfB24QDjupQb6eJkQTqWgezy0S0x+unhk X-Received: by 2002:a9d:6183:: with SMTP id g3mr70864840otk.304.1577652462562; Sun, 29 Dec 2019 12:47:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577652462; cv=none; d=google.com; s=arc-20160816; b=QdYE5QI790I4jd8GxhA5UB61yf7dl3u5XMUlViG6NXmeK51lG8OCkSbKcpnHK4Um8x kNTokRZ24tCCOlKnR/VLZdWI+yDBzlE112W3xReyRhd6vjKSIYcBddXm9b9lWzqW+2fi lFb3dJZgh4sqHOkODmr9gggT75AGG2xUI25maVAa7q2ElzSgthDkzTIQcrPPyCeZBO0a EdOxtMn3nr4DKSP4IZwbYrNihqXQeTeFqy6cDeJmVhtARKJLNAvK2UA2zzCL9RxJywWF 0OFTZ7GARQwLiW2ZK+VSDvETGo0KbuzP1GV7DvIj000zjJswx7f4Nyy/K9WJ0YLQokyc xjmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AQNbY03r7kXXyFj7y6kPacC+ZL5I+WFdPWvxkAoFsvI=; b=yVdpLxN1czSeZvhOF+dVkCKP3iZygTw1RbV/pjy+gL555W3Wpy2C/Xe74LRNsXs3mK vVO30fwx/TRSobmtZFIbUVQwr+skJGcKqHkGyKVfew6Hom5byxKTXNYcDlE2ZUWfBgmT pCkV1X+StwKRbjYOohji2b1eZZSOJwWugSm5dVM4CDQ2mTzv0DBZqKJvErup/GQelHD+ QzJfusUxuG2HaoCodHdMbg4KWDoRHP7i+zm5e1op6PL9Daq0zYTIFLF0kweM4nNjOBz/ Sb0UvtXA3D+SXsA86z9tdBXeWEBSS+KYp2TJS5h/oFrmh7dO/ITU0EL5Gy6QQynqzJQn nHHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WF8G199U; 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 16si27061866otk.151.2019.12.29.12.47.31; Sun, 29 Dec 2019 12:47:42 -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; dkim=pass header.i=@kernel.org header.s=default header.b=WF8G199U; 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 S1731854AbfL2RuU (ORCPT + 99 others); Sun, 29 Dec 2019 12:50:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:34672 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731524AbfL2RuR (ORCPT ); Sun, 29 Dec 2019 12:50:17 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 070AA206A4; Sun, 29 Dec 2019 17:50:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577641816; bh=FmcKULmvubKzpyFssXEJhR9jlH3zBABRcOFRVNTB0lc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WF8G199Urc3Uqj2yduQ8IXPdifqwE8eQ9FrcpZiV/7RIuCRR7/CgD2i9QJ31Et68O tG4Y2+f6ZMYm0wFxLK3Zf8EovC9SA0LPEdMctV9IN7foxaCgMbpOawQRcetMirShfj 2qAPSH4J53uf6EC068qtkPRDYvv9orkzevqN1sPM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuhong Yuan , Palmer Dabbelt , Mark Brown , Sasha Levin Subject: [PATCH 5.4 222/434] spi: sifive: disable clk when probe fails and remove Date: Sun, 29 Dec 2019 18:24:35 +0100 Message-Id: <20191229172716.592655591@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229172702.393141737@linuxfoundation.org> References: <20191229172702.393141737@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chuhong Yuan [ Upstream commit a725272bda77e61c1b4de85c7b0c875b2ea639b6 ] The driver forgets to disable and unprepare clk when probe fails and remove. Add the calls to fix the problem. Signed-off-by: Chuhong Yuan Reviewed-by: Palmer Dabbelt Link: https://lore.kernel.org/r/20191101121745.13413-1-hslester96@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-sifive.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-sifive.c b/drivers/spi/spi-sifive.c index 35254bdc42c4..f7c1e20432e0 100644 --- a/drivers/spi/spi-sifive.c +++ b/drivers/spi/spi-sifive.c @@ -357,14 +357,14 @@ static int sifive_spi_probe(struct platform_device *pdev) if (!cs_bits) { dev_err(&pdev->dev, "Could not auto probe CS lines\n"); ret = -EINVAL; - goto put_master; + goto disable_clk; } num_cs = ilog2(cs_bits) + 1; if (num_cs > SIFIVE_SPI_MAX_CS) { dev_err(&pdev->dev, "Invalid number of spi slaves\n"); ret = -EINVAL; - goto put_master; + goto disable_clk; } /* Define our master */ @@ -393,7 +393,7 @@ static int sifive_spi_probe(struct platform_device *pdev) dev_name(&pdev->dev), spi); if (ret) { dev_err(&pdev->dev, "Unable to bind to interrupt\n"); - goto put_master; + goto disable_clk; } dev_info(&pdev->dev, "mapped; irq=%d, cs=%d\n", @@ -402,11 +402,13 @@ static int sifive_spi_probe(struct platform_device *pdev) ret = devm_spi_register_master(&pdev->dev, master); if (ret < 0) { dev_err(&pdev->dev, "spi_register_master failed\n"); - goto put_master; + goto disable_clk; } return 0; +disable_clk: + clk_disable_unprepare(spi->clk); put_master: spi_master_put(master); @@ -420,6 +422,7 @@ static int sifive_spi_remove(struct platform_device *pdev) /* Disable all the interrupts just in case */ sifive_spi_write(spi, SIFIVE_SPI_REG_IE, 0); + clk_disable_unprepare(spi->clk); return 0; } -- 2.20.1