Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753421AbcKYVzq (ORCPT ); Fri, 25 Nov 2016 16:55:46 -0500 Received: from mail.ispras.ru ([83.149.199.45]:60578 "EHLO mail.ispras.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752980AbcKYVzj (ORCPT ); Fri, 25 Nov 2016 16:55:39 -0500 From: Alexey Khoroshilov To: Greg Kroah-Hartman Cc: Alexey Khoroshilov , linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Subject: [PATCH] uio: pruss: add clk_disable() Date: Sat, 26 Nov 2016 00:55:30 +0300 Message-Id: <1480110930-8473-1-git-send-email-khoroshilov@ispras.ru> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1214 Lines: 43 pruss_probe() enables gdev->pruss_clk, but there is no clk_disable() in the driver. The patch adds clk_disable() to pruss_cleanup() and error handling for clk_enable(). Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov --- drivers/uio/uio_pruss.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/uio/uio_pruss.c b/drivers/uio/uio_pruss.c index ca9e2fafb0b6..31d5b1d3b5af 100644 --- a/drivers/uio/uio_pruss.c +++ b/drivers/uio/uio_pruss.c @@ -111,6 +111,7 @@ static void pruss_cleanup(struct device *dev, struct uio_pruss_dev *gdev) gdev->sram_vaddr, sram_pool_sz); kfree(gdev->info); + clk_disable(gdev->pruss_clk); clk_put(gdev->pruss_clk); kfree(gdev); } @@ -143,7 +144,14 @@ static int pruss_probe(struct platform_device *pdev) kfree(gdev); return ret; } else { - clk_enable(gdev->pruss_clk); + ret = clk_enable(gdev->pruss_clk); + if (ret) { + dev_err(dev, "Failed to enable clock\n"); + clk_put(gdev->pruss_clk); + kfree(gdev->info); + kfree(gdev); + return ret; + } } regs_prussio = platform_get_resource(pdev, IORESOURCE_MEM, 0); -- 2.7.4