From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9D35C43381 for ; Fri, 22 Mar 2019 13:03:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8F8C1213F2 for ; Fri, 22 Mar 2019 13:03:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553259800; bh=Y8ekJcTW0lp9Zkbb3KKvUQ1/M2GyrKZSOT1to9yNkpE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=kqienATFZdnSXPwSu1gTf+hqlAhWMhAl/SFYp+yeEawwaFtLLQyNgCJTeAlT3VEa8 Uo9Khr8B0jmEjPWWNToh0XfBr6pQuBw0pYmD6ZUV8MdTEmCNhWLuI9wweOjBgTxsLJ TLcJlkJ69kryLcmG6qkQsjgmh04jLFCsFw+AnxpM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731284AbfCVLkp (ORCPT ); Fri, 22 Mar 2019 07:40:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:42746 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730924AbfCVLko (ORCPT ); Fri, 22 Mar 2019 07:40:44 -0400 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 C0B252082C; Fri, 22 Mar 2019 11:40:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553254843; bh=Y8ekJcTW0lp9Zkbb3KKvUQ1/M2GyrKZSOT1to9yNkpE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=klE2ruOvJ2OAyM72ZeaYIOO0ET7GQ5b7OY9OeZgl2SFE+BKWvCf9qxOFhCDddceym ROmVAWJNYu0Jw8vPP1rkBXtkywviwPlTOWrbaB1AvPFsJdC/jva3QYaCJS0gI6nWTv fnPAIFCYcNPtw5Q3LWj+zmK5vI/GpEXOjEUxvMmM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Khoroshilov , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 028/118] net: mv643xx_eth: disable clk on error path in mv643xx_eth_shared_probe() Date: Fri, 22 Mar 2019 12:15:00 +0100 Message-Id: <20190322111218.145649264@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111215.873964544@linuxfoundation.org> References: <20190322111215.873964544@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit e928b5d6b75e239feb9c6d5488974b6646a0ebc8 ] If mv643xx_eth_shared_of_probe() fails, mv643xx_eth_shared_probe() leaves clk enabled. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/marvell/mv643xx_eth.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index 5b12022adf1f..526d07e02bbc 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c @@ -2886,7 +2886,7 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev) ret = mv643xx_eth_shared_of_probe(pdev); if (ret) - return ret; + goto err_put_clk; pd = dev_get_platdata(&pdev->dev); msp->tx_csum_limit = (pd != NULL && pd->tx_csum_limit) ? @@ -2894,6 +2894,11 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev) infer_hw_params(msp); return 0; + +err_put_clk: + if (!IS_ERR(msp->clk)) + clk_disable_unprepare(msp->clk); + return ret; } static int mv643xx_eth_shared_remove(struct platform_device *pdev) -- 2.19.1