Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4634753iob; Sun, 8 May 2022 20:02:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzf07mrGJ6LCVDpm+FA/VXfPapWPWcZpHyCf55s1oBE8WK2oh6mJSYv5S99kQVfH2Mslzz4 X-Received: by 2002:a17:902:b78c:b0:15d:2431:a806 with SMTP id e12-20020a170902b78c00b0015d2431a806mr14370005pls.77.1652065364571; Sun, 08 May 2022 20:02:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652065364; cv=none; d=google.com; s=arc-20160816; b=WRhNhjG0+YeMRolFYuDATw3MiT1BznnsY5XYajPumRFAmRfHedzdTS5/RH6eTvjOLM OFVyHXBh4krVzs5OGdrdU8oLO9Z4FjNl17YQQi0FQIWXfsa5iXDnMWM+RCpDysWfUsDP XW5ZJgay2+It/bStsxgs7okvFqL6XdLKFNwtJtWzbqDyFPrKReDuiLGY0H6azm6Uwm+4 qyMtXPilZ1QcltRLCVkBYq799pbANScW/3ARCSXxfOsHDQ/jkKsLlkUpfdJikZQleGFJ MaPGW+FGBbJouonYm/3MMqw/5LpsO6+BJcQv1FRoTvy/V+udzq6M62kocQh6ZNuZ6RI0 0BLA== 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=MTgCgrwJcWB0HRMAGTWf8Lbmwg0+gGXabfRAx8Q9Zdc=; b=z6+wYz6Vyo4rqkuMlIGSFHEqVQZm3cKTA9dRl5cvLbvxIEKCIeOtMGNA99QmFmrCxW jfz4zOJ3N7gLSfcthAOE3YrKYAc7S5wifKmUW3CTmtYKT1vo5SUoma9seXvn8TUeCN7/ ZaU4Wd+I2PBjG/MuKPDd+IXjiExQj3LKHPKBspToq9vADC4aVM1aQpgVPoubWVmLpXLq oyQUvY8xBWb7eG1udBG2uj7fAeFr8x5sTeCd2z4c4OBEK8BLQZOdnUNBfiXqo0gKWeLo YyLAyNYyUzQSnxu1kR/MVS2/NETYXNkXNXMP3EPtq2O4BT3PxLezUzQEd9QHC+Cc4sYq c3Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Zbaqlqbo; 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 lk18-20020a17090b33d200b001d7d1d49e93si21529283pjb.129.2022.05.08.20.02.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 20:02:44 -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=Zbaqlqbo; 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 9175E5A14F; Sun, 8 May 2022 20:01:15 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357122AbiEDRWd (ORCPT + 99 others); Wed, 4 May 2022 13:22:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355863AbiEDREp (ORCPT ); Wed, 4 May 2022 13:04:45 -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 4EA934F45D; Wed, 4 May 2022 09:53:28 -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 149C361505; Wed, 4 May 2022 16:53:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E7C7C385A4; Wed, 4 May 2022 16:53:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683207; bh=3hVsmT5G8vgBYDvAK4nk4B5RhbZAjeVci/nVWw3xb8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zbaqlqboai8q944AaQn6smfAEhDepQGsMmqC4V/cSalg4CGxoUw953K2p9nV6Nee+ f2VPcwansU0bFWQsSS4a6ANr/mVRis6p5TO/ZpE5mybA89AFDXSwMptnsftzpieMMb YZYfnTYlyRxBFylGRRrlwyuGRcQk1mCRmyaEzWEE= 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.15 059/177] phy: samsung: exynos5250-sata: fix missing device put in probe error paths Date: Wed, 4 May 2022 18:44:12 +0200 Message-Id: <20220504153058.294836259@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153053.873100034@linuxfoundation.org> References: <20220504153053.873100034@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 6c305a3fe187..595adba5fb8f 100644 --- a/drivers/phy/samsung/phy-exynos5250-sata.c +++ b/drivers/phy/samsung/phy-exynos5250-sata.c @@ -196,20 +196,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); @@ -217,11 +218,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