Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6228161iob; Tue, 10 May 2022 13:22:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXNFy67Naip6Cj2WBHSp1vcsCkz3rXL5lgaJqkGkSIVTOHFYLMPc8Xf7M8rXfQMZSWJZWc X-Received: by 2002:a17:90b:1e41:b0:1de:b2dc:b2e with SMTP id pi1-20020a17090b1e4100b001deb2dc0b2emr1588241pjb.69.1652214134355; Tue, 10 May 2022 13:22:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652214134; cv=none; d=google.com; s=arc-20160816; b=wvPNWNPCx+7O+SfqxvDlLO6ObmpSKaCQOEzcqOBMuxQ/q1H4vkFPGsslgyxqB0lCoF Bgaa4Lf62wTa2POBhfUIzBarfGQ1JKhOWlyRhoIh1w1kHgNK31BqCvqe0SdthVXgWY55 K1any5nBXM6RXDMYRmZY8UUJXHOylOWTQWHP5bDVs8GCANs7EOhqiS6Ad9UppcCiBXZ5 BgtMGB2+StIsIkXujc9oHz+nV+Hjdo3xUZ7lquAkWB8HrL3F/awB1mSPilsWLbsCwYMx FeVA+mKmd8JJz08XjqAcDYdOAjYSFA7/ggtfWJjKSZ+YMVmzEFAPUGDELMHlpTQoXnT0 qpEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=V6RSUWHWNeeTETp8Cf7VlAiGQsjdkKg8R1xQ7zEL3ro=; b=ZaCSJ+aJgMcP9NdlV9qN3rcPd6v5i/k49z82RzuV0mPGUzHfzBYekelbdiCNZXHr2g tsTQcJ9wQYfbHNGSqaRUoCEkl1hxZmuGaOGbEakLcX+VhHlTFgSyl7NBWW81+16iI9V5 s0JK4+XLWzam+6lwRb9UBOo3uAUe6EYfY+RoWzjqEyjn0awuClNnp254k3dWkFc13RGA vc3shVKq/SY5RzptgXwOHUtfVBFfv6jf7oFlQF45Hbzc27nRoFIudsUdgZR7yek4wPz5 cZLr7I339sC+HCKXLqzbuGkdaSCCCVw5B1TDGH7kbwz42qxJN0uLuT0HPNAG+vdo+fQr /nNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HlJzecGd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z10-20020a6552ca000000b003c66102b79esi158119pgp.853.2022.05.10.13.21.58; Tue, 10 May 2022 13:22:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HlJzecGd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243508AbiEJNbH (ORCPT + 99 others); Tue, 10 May 2022 09:31:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243188AbiEJNVi (ORCPT ); Tue, 10 May 2022 09:21:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 319BE5AEF9; Tue, 10 May 2022 06:15:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D9C68B81DA3; Tue, 10 May 2022 13:15:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D0ECC385A6; Tue, 10 May 2022 13:15:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652188501; bh=yLrBDSoik5lYxYHt4/zuvrMAWSDosPSALRSAGfIGK3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HlJzecGdyOsWmuwWW+doDjwGyTHPIcNu6yFeqUCQw+L80XfG5Ypt1CipEasrfDnqr aOU29uzA/TZMZZTc9zG4I/2bYy3cJajyH3VF8/q4B2Xw7uR8QYEGcfqwqKlLnCZCeB wBgHhnS43X4VW8R6DvMxI8syoLCVvfO1xVTvbBdw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Alim Akhtar , Vinod Koul , Sasha Levin Subject: [PATCH 4.14 28/78] phy: samsung: exynos5250-sata: fix missing device put in probe error paths Date: Tue, 10 May 2022 15:07:14 +0200 Message-Id: <20220510130733.368696836@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220510130732.522479698@linuxfoundation.org> References: <20220510130732.522479698@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Krzysztof Kozlowski [ Upstream commit 5c8402c4db45dd55c2c93c8d730f5dfa7c78a702 ] The actions of of_find_i2c_device_by_node() in probe function should be reversed in error paths by putting the reference to obtained device. Fixes: bcff4cba41bc ("PHY: Exynos: Add Exynos5250 SATA PHY driver") Signed-off-by: Krzysztof Kozlowski Reviewed-by: Alim Akhtar Link: https://lore.kernel.org/r/20220407091857.230386-2-krzysztof.kozlowski@linaro.org Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/samsung/phy-exynos5250-sata.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/phy/samsung/phy-exynos5250-sata.c b/drivers/phy/samsung/phy-exynos5250-sata.c index 7960c69d09a6..2c39d2fd3cd8 100644 --- a/drivers/phy/samsung/phy-exynos5250-sata.c +++ b/drivers/phy/samsung/phy-exynos5250-sata.c @@ -202,20 +202,21 @@ static int exynos_sata_phy_probe(struct platform_device *pdev) sata_phy->phyclk = devm_clk_get(dev, "sata_phyctrl"); if (IS_ERR(sata_phy->phyclk)) { dev_err(dev, "failed to get clk for PHY\n"); - return PTR_ERR(sata_phy->phyclk); + ret = PTR_ERR(sata_phy->phyclk); + goto put_dev; } ret = clk_prepare_enable(sata_phy->phyclk); if (ret < 0) { dev_err(dev, "failed to enable source clk\n"); - return ret; + goto put_dev; } sata_phy->phy = devm_phy_create(dev, NULL, &exynos_sata_phy_ops); if (IS_ERR(sata_phy->phy)) { - clk_disable_unprepare(sata_phy->phyclk); dev_err(dev, "failed to create PHY\n"); - return PTR_ERR(sata_phy->phy); + ret = PTR_ERR(sata_phy->phy); + goto clk_disable; } phy_set_drvdata(sata_phy->phy, sata_phy); @@ -223,11 +224,18 @@ static int exynos_sata_phy_probe(struct platform_device *pdev) phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); if (IS_ERR(phy_provider)) { - clk_disable_unprepare(sata_phy->phyclk); - return PTR_ERR(phy_provider); + ret = PTR_ERR(phy_provider); + goto clk_disable; } return 0; + +clk_disable: + clk_disable_unprepare(sata_phy->phyclk); +put_dev: + put_device(&sata_phy->client->dev); + + return ret; } static const struct of_device_id exynos_sata_phy_of_match[] = { -- 2.35.1