Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3244198imc; Wed, 13 Mar 2019 12:33:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxO8Mg9Xx7OkWfsk9IC3Jh2DvkWL6H8e6pnOoPrbVs0r7p6gvZgWlvh46PCKPeh4IDKyqUi X-Received: by 2002:a63:d302:: with SMTP id b2mr16633088pgg.13.1552505639766; Wed, 13 Mar 2019 12:33:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552505639; cv=none; d=google.com; s=arc-20160816; b=iVJJSkuDgGoE5519OX6/fik7IXHtNTwLsYMoqlDGSJ/QozxtzXeTxWWiQvOVHSA6gY G59sPniMz48cOBxK0mB7XDdVg3FZLdK9AfQx/o6Joehd2ImHYDXfT8kV0WZAEaCzlUoL dXt6RTUeON6d569BgaTs0es6rX7TlrtMiBNeJMHz+q/1OP7GpSJtKikmsK9tOdBgyg5s XncgttmgT7RWP0iDFFUEg3UnXo49fotZffkTtanyhFAUku+sFtaxMyhPmsjWNiFCxiR9 0Czc5BF+UWQQRAY0M9MdiDzGqvp50DZI9RROxSanr7CMpSE8xzHpiyGeKPwN3QuNEAX0 251Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fXCUU6mXbIeCKiSYyyrRpEXSMBtaN1C1rZp1Aj60jDg=; b=I0jCuL7KElLva6qjVasXNk20RqIaBOH74LytlvaweeG5Z9SfN1nLvZO5GqTcr6L1lK E3Vu5MR2mC36cSxlSpkrDBdoxyxKNstQFs5npn1LFLkPGuyAbnQTp9+B98oMa3rR5hSU Ss7hh5B86xjknl4Ofi21baQak7dl9Y3ZY4hmnEDJTjCwX8TaKPXhQpbuXyTPG1ySq+0Y IZusy1gTFMnZCyGMx8KRkxD6RYnrFBvRVpsRVt0vDBw3uVPeqYKV4f0YnrvmUybQUphS lFDrL6wzAAcixmoGlqmUaJJGbPOZPiSLYmn4oQmozQ83AfvAQnuoXlVC9rNLn6YCVPFB BGjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="FJOBMK/5"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g90si1182399plb.51.2019.03.13.12.33.43; Wed, 13 Mar 2019 12:33:59 -0700 (PDT) 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="FJOBMK/5"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727738AbfCMTcr (ORCPT + 99 others); Wed, 13 Mar 2019 15:32:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:41622 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727310AbfCMTLD (ORCPT ); Wed, 13 Mar 2019 15:11:03 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6BB182177E; Wed, 13 Mar 2019 19:11:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552504262; bh=ozl9ompCEz9p5sFCeNxh/kYdCKA3sI/GyI43D608eH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FJOBMK/55OrG1bczdbsaSv1pgKvv1BmPj2JaEVwasjmo87ulgWUDzEK8SAMliGjzi +Pm/Dy8tLmNRxum6F88vPducxK12cMeSgh/oeFN8rVn/6An6L4SX++SxUdYCYIvLyU VjC6CO70dEp4R+fvlf+QMo3MLwpf9FzYW9SQJ0d4= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Alexey Khoroshilov , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.20 19/60] net: mv643xx_eth: disable clk on error path in mv643xx_eth_shared_probe() Date: Wed, 13 Mar 2019 15:09:40 -0400 Message-Id: <20190313191021.158171-19-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190313191021.158171-1-sashal@kernel.org> References: <20190313191021.158171-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexey Khoroshilov [ 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 1e9bcbdc6a90..55dd3437bb20 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