Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4614383iob; Sun, 8 May 2022 19:16:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoIVJJByo0Mmrza20/tQeD4NXJE1ittCr9uffcUBBGmaGBS3hgwTziUXkWBZ0cVx+tvPo/ X-Received: by 2002:a63:2d3:0:b0:3c2:2f74:2dd8 with SMTP id 202-20020a6302d3000000b003c22f742dd8mr11250305pgc.204.1652062597769; Sun, 08 May 2022 19:16:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652062597; cv=none; d=google.com; s=arc-20160816; b=bSevCOoXrkVOjcSPrCnRpGJqX/jU/BZs/S3i+5oTD7Uh4edyMuFJmIeZXovp42qzSl l/xoKuYgYx44q522MKP6arigEKBFVvLoY6YIdw7DXlNmdrt2JU0iG0vPoQmoub2j7xqf NXEXnoK22hYCeMOLc993H3PS1e0xuNkSt8UmhjrMAli75A9yXuwenwBdeDBeJlVMK/4r uZrPBxuE55tfMVcnKPhcicdaKDtdlWFP/MTPYnMsziDNtcxn28Citav8kHw0eoSSV5dF 0kSO7BdkPz3qdX1+xG3UGmmzlRJCzT5e2Jb5UOSlqatA51LYvCo4zP047EGH3qyPFx28 NpuA== 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=cAYKfbNfLD8nVGhhIJpOcSsJ8DEiF+OZ/+gQ/qxxqrA=; b=qSKX3BnRC0X37iSJ3Sw1nXv4SobQikT+8OrTS21LNXVtjQKQ3TkL664MprbaDMYPPH YKmghCJwFGwgXBjlgJaRBP9i0pRK3Pq+pUxUAbRcT9owhXGHt18YRczh5+qcHj5xtkcz nh5TItYxajrTFxGjO1U9NFr0AWVTUoSKLxXdm1cEGBaR2srgyt9qDaawjrX1JSun1Sx6 TodmzPF+yiUVEVyI0MclkKwKt/LOa6n3paaHoG9SM7/LcbQMufIcjSEJKUU3XD+pJ9+L 4BPK+Y4Wucl0P+rTnc+553EUjSutLtXZu+bfKa701nvZECahH0tRrpgUiPMJsSEU3TD2 X9fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VgwUbkZQ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k1-20020a634b41000000b003c682f6168asi6188841pgl.292.2022.05.08.19.16.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 19:16:37 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VgwUbkZQ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 45A2A554AD; Sun, 8 May 2022 19:15:28 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355682AbiEDREj (ORCPT + 99 others); Wed, 4 May 2022 13:04:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354677AbiEDQ67 (ORCPT ); Wed, 4 May 2022 12:58:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FE302E9ED; Wed, 4 May 2022 09:50:51 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 573116179D; Wed, 4 May 2022 16:50:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A625BC385A4; Wed, 4 May 2022 16:50:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683050; bh=DAKZ+IMFhB3kynJd+4BTivE21C0uCBxfzjW6JzSQ6Go=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VgwUbkZQlop8h+DpbsXYnOMk5s5cY4eSXpmP8N43TAEN+EmmtCScUNUoiu81cecKr zG5IHQM4jKNnxjJQ0KCTeKPZFxlri7pB60ncugAhjp6EbOdXtwxi+KUk/VAksMORO2 UQtJ0e7n2EifJog00Y9D6Ae4d6zfTOYiRvKNWsuk= 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 5.10 046/129] phy: samsung: exynos5250-sata: fix missing device put in probe error paths Date: Wed, 4 May 2022 18:43:58 +0200 Message-Id: <20220504153024.801221958@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153021.299025455@linuxfoundation.org> References: <20220504153021.299025455@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=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 5077987570fd..ea46576404b8 100644 --- a/drivers/phy/samsung/phy-exynos5250-sata.c +++ b/drivers/phy/samsung/phy-exynos5250-sata.c @@ -199,20 +199,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); @@ -220,11 +221,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