From patchwork Wed Apr 27 06:32:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 12828323 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E9717C4332F for ; Wed, 27 Apr 2022 06:35:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3WAhjX6HCn8Dnj42ikPV0hz7S3/4SoFFs4pDKk2gCXo=; b=D5FSUFDRxQ71Gi byn62ihxWoYxTSOTyLALwuPZHG1+J/aHQYeO5EM5iA4b5eBnbCuihocAc8zsVgqHnqB81Tq4AqjbB wIsOqawUnP6XoSjUiRWCKgQ7+0Bn4bYh9HwcB7ff4qNzDfiEVCb8RwJ5L+XPsVsyrjLum6l0EN8eR RjXZmFJeDkf8lJFPlPowpCshI1Z21xX+VKlagid4BiJ0ihgZQO0E2k/tIOmSQHLb2S/kiZel2BLNC 1x4Cfsqk6OXbF4GQRoJ3AMdixxeox0Y5/vLgyG/+4M5/0nU71rYFoA3a/1mmUK2DhUt/Nvsv/wfB8 YA9vP3vgGCM2F9852qrQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1njbH4-0001EN-BZ; Wed, 27 Apr 2022 06:35:42 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1njbH0-0001AD-2u for linux-phy@lists.infradead.org; Wed, 27 Apr 2022 06:35:40 +0000 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 8F657B824AA; Wed, 27 Apr 2022 06:35:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51659C385AE; Wed, 27 Apr 2022 06:35:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651041335; bh=JfzgUR4uDHZ8zRHtskqu08bEed+yBY133dHufapfmEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ck2iTmTAsUUE+2D6iR06PiNIQEb3JVDPmJ/lSsITZzm4JPbZKC4MxuuExgzHZIHHq RoqbjVKSKVn0y0+jkWbMXokKE8r6W86yXyaVZPABz/P7vewdNniI1XMlnBLYf8DDjW UOhg0CR/YbrMCUETIl91yAhATYI28NAOsb5ULeuNLJFAV4sDAygb/LWkEOAgaE+6yN dzFx3U8d6xOBCoGgKHlSWCsn/S+fBBux6nCockyprv+GapCU8YkURuqIsvGCRSZgqd o8dwRb/ep5k785B2A7ZxN40bGwWDIYFd131ZT+ue9zTHiShoWFHwL+ncsIDmvL8goR 7Wk5CVwJXViiA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1njbGy-0008VV-UJ; Wed, 27 Apr 2022 08:35:36 +0200 From: Johan Hovold To: Kishon Vijay Abraham I , Vinod Koul Cc: Andy Gross , Bjorn Andersson , Philipp Zabel , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org, Vivek Gautam Subject: [PATCH v2 1/3] phy: qcom-qmp: fix struct clk leak on probe errors Date: Wed, 27 Apr 2022 08:32:41 +0200 Message-Id: <20220427063243.32576-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220427063243.32576-1-johan+linaro@kernel.org> References: <20220427063243.32576-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220426_233538_301552_A8BAA096 X-CRM114-Status: GOOD ( 11.59 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Make sure to release the pipe clock reference in case of a late probe error (e.g. probe deferral). Fixes: e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets") Cc: stable@vger.kernel.org # 4.12 Cc: Vivek Gautam Reviewed-by: Bjorn Andersson Signed-off-by: Johan Hovold --- drivers/phy/qualcomm/phy-qcom-qmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c index 7d2d1ab061f7..a84f7d1fc9b7 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp.c @@ -6077,7 +6077,7 @@ int qcom_qmp_phy_create(struct device *dev, struct device_node *np, int id, * all phys that don't need this. */ snprintf(prop_name, sizeof(prop_name), "pipe%d", id); - qphy->pipe_clk = of_clk_get_by_name(np, prop_name); + qphy->pipe_clk = devm_get_clk_from_child(dev, np, prop_name); if (IS_ERR(qphy->pipe_clk)) { if (cfg->type == PHY_TYPE_PCIE || cfg->type == PHY_TYPE_USB3) { From patchwork Wed Apr 27 06:32:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 12828324 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E9744C43217 for ; Wed, 27 Apr 2022 06:35:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uuBF+yMaC3tIFn5RL8LmFqN8hi/ZLnqE3Gjk2EOHiAs=; b=3qTrkOJpLJBTDy IsCjRBkdhO0jmCGSDTjOhnBAFr+8MyCLZHQ3rHWnvjBHaVDK9mmqFT+7lFCRNKAhE3oV7uXCJ27DL +ukxf78IwjubAzaAjqJ42MlnkbJf0jaxhYCvLtMkhFEwwq+o39kLuWkhUSzU7dYa8tXKfZc4KGCBm A9Mmuo6nZNLFQAzC7co24M1WkdU3F7QAjUZ6NCz8rz42fC1pmuE+3N2c3At0bHSBvz9N8HUZEFyVA Dm/V1pQocTIn4DLJEtzUebiosdziS1Sbrr/GRUf4UaDlBioDdUOu1Eo9tMOBrYfUllftBJolvWWUM muB18RDuMYPmuf7YFsww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1njbH4-0001EE-7V; Wed, 27 Apr 2022 06:35:42 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1njbGz-0001A2-IM for linux-phy@lists.infradead.org; Wed, 27 Apr 2022 06:35:40 +0000 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 EFD80618E5; Wed, 27 Apr 2022 06:35:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D70FC385A7; Wed, 27 Apr 2022 06:35:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651041335; bh=3dR4OmJG6gvns4unQ6WAXw8yKHmRGcvo/1l1zQKbAjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SrC/WdTNWFNfHhphHcADN0Uj1HB/ajgQQk/SVaFmBHboQexT0Ni0bhvnDn2GAc0pu ayv1DqjD4KA0GArUFsiIy5odk7lkBFJtrbEiy3IZCK7E1Wq2hMHvQv0eEKARppo5yI nr+DFInofCApcnGan60uvb/2Wwww6LgobLRX4aK10CED2i2LoGnE1+qMZnt+634ugN EnwHfcvCuWTb0CYPApsbwW5ejHDvocYYpioljUKjchKZZ9XIKCOHutdTbCr8WTiL70 Dwzd/1TKoHR+VV9L724z73kaFFNO2w7I3mH6WjvI2uUt0yMBIEthkl47+oBcbrX5sl +r37uP99tFkUw== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1njbGz-0008VX-0a; Wed, 27 Apr 2022 08:35:37 +0200 From: Johan Hovold To: Kishon Vijay Abraham I , Vinod Koul Cc: Andy Gross , Bjorn Andersson , Philipp Zabel , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org, Vivek Gautam Subject: [PATCH v2 2/3] phy: qcom-qmp: fix reset-controller leak on probe errors Date: Wed, 27 Apr 2022 08:32:42 +0200 Message-Id: <20220427063243.32576-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220427063243.32576-1-johan+linaro@kernel.org> References: <20220427063243.32576-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220426_233537_677747_C242961F X-CRM114-Status: GOOD ( 11.07 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Make sure to release the lane reset controller in case of a late probe error (e.g. probe deferral). Note that due to the reset controller being defined in devicetree in "lane" child nodes, devm_reset_control_get_exclusive() cannot be used directly. Fixes: e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets") Cc: stable@vger.kernel.org # 4.12 Cc: Vivek Gautam Reviewed-by: Philipp Zabel Signed-off-by: Johan Hovold Reviewed-by: Bjorn Andersson --- drivers/phy/qualcomm/phy-qcom-qmp.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c index a84f7d1fc9b7..3f77830921f5 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp.c @@ -6005,6 +6005,11 @@ static const struct phy_ops qcom_qmp_pcie_ufs_ops = { .owner = THIS_MODULE, }; +static void qcom_qmp_reset_control_put(void *data) +{ + reset_control_put(data); +} + static int qcom_qmp_phy_create(struct device *dev, struct device_node *np, int id, void __iomem *serdes, const struct qmp_phy_cfg *cfg) @@ -6099,6 +6104,10 @@ int qcom_qmp_phy_create(struct device *dev, struct device_node *np, int id, dev_err(dev, "failed to get lane%d reset\n", id); return PTR_ERR(qphy->lane_rst); } + ret = devm_add_action_or_reset(dev, qcom_qmp_reset_control_put, + qphy->lane_rst); + if (ret) + return ret; } if (cfg->type == PHY_TYPE_UFS || cfg->type == PHY_TYPE_PCIE) From patchwork Wed Apr 27 06:32:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 12828322 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B2A8AC433FE for ; Wed, 27 Apr 2022 06:35:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yeYbnDRbUhTUhCVWnm9kVXDLENlKrgutoRZ8Q6egglQ=; b=KGJq3B6Kfjg4dY OfvAbU2w8RaY0IS5TqyQgOLCTzc4kB63BrQHoiTaOc8cr0/uaaA3gugQ3CFbCjdIAw0DoEtbqx1Hs sM4LxFvK7gcFHCQQE2bYkMLZMKa9roJBndgkVKsi5nL+bXtC53LhvtWGdGwrbbjBE7gIePQHEH82X sjTgGinmPaS3HwTQQJZjEvV4lBt24YOb7lUVO8/ZSLL9G2MxuL+Ki3XySZMUZL980y5ShxmsSIu6L fCTjDT0Z6DTdJ5ueJdyQbTkmyfQuBYi6czzSV+C0getUURGTybARQEBYPQqnkzSrwGTtsuF+5RZBX e3As/u3sGrOJeO0tOdNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1njbH4-0001Du-3S; Wed, 27 Apr 2022 06:35:42 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1njbGz-0001A1-ET for linux-phy@lists.infradead.org; Wed, 27 Apr 2022 06:35:40 +0000 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 EB63461799; Wed, 27 Apr 2022 06:35:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53DE8C385AF; Wed, 27 Apr 2022 06:35:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651041335; bh=S7L7LCfQw9ybG+HTyJrxZ9N79OTqInjfPScQ2OGVp+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Aw/hwbhuNiAjclNMtdRoTPB/EuKV8w/i9HhU75hQvcpQnRi975vAk904voio6LY3e 97U+eP03pUzkl+a29/PzZA7K5H0s7jWlo2QsWVcEIiSw++JlNGoxrVg+e5DCM77ESu ROsL0egHLEpo5f55H/WyvFxaCVGTQGt1C6kE0E2sat6cO/k+m3zb5poUDyKd+B3WCK HNs2SoJkjeBDkdHAeVpoMglvvonXHjsXLhuq1c6rEeO/aMzHNLuIVpFzn/SfbIWiSK kIRkQkOrx6/l34MieqhhWkghjDnLgFZNn6g2+X96lv3FLNnhsuVlUVf3wpVIjxaSNB QaRfeOCLNcPmQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1njbGz-0008VZ-3R; Wed, 27 Apr 2022 08:35:37 +0200 From: Johan Hovold To: Kishon Vijay Abraham I , Vinod Koul Cc: Andy Gross , Bjorn Andersson , Philipp Zabel , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH v2 3/3] phy: qcom-qmp: switch to explicit reset helpers Date: Wed, 27 Apr 2022 08:32:43 +0200 Message-Id: <20220427063243.32576-4-johan+linaro@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220427063243.32576-1-johan+linaro@kernel.org> References: <20220427063243.32576-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220426_233537_558378_AE1B9CE3 X-CRM114-Status: GOOD ( 13.12 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Switch to consistently using the explicit reset-controller API which makes it clear that the reset controllers are used exclusively by the PHY driver. Note that the deprecated of_reset_control_get() and devm_reset_control_get() are just transitional wrappers for the explicit API so there's no functional change. Suggested-by: Philipp Zabel Signed-off-by: Johan Hovold Reviewed-by: Bjorn Andersson --- drivers/phy/qualcomm/phy-qcom-qmp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c index 3f77830921f5..160d723fc773 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp.c @@ -5701,7 +5701,7 @@ static int qcom_qmp_phy_reset_init(struct device *dev, const struct qmp_phy_cfg struct reset_control *rst; const char *name = cfg->reset_list[i]; - rst = devm_reset_control_get(dev, name); + rst = devm_reset_control_get_exclusive(dev, name); if (IS_ERR(rst)) { dev_err(dev, "failed to get %s reset\n", name); return PTR_ERR(rst); @@ -6099,7 +6099,7 @@ int qcom_qmp_phy_create(struct device *dev, struct device_node *np, int id, /* Get lane reset, if any */ if (cfg->has_lane_rst) { snprintf(prop_name, sizeof(prop_name), "lane%d", id); - qphy->lane_rst = of_reset_control_get(np, prop_name); + qphy->lane_rst = of_reset_control_get_exclusive(np, prop_name); if (IS_ERR(qphy->lane_rst)) { dev_err(dev, "failed to get lane%d reset\n", id); return PTR_ERR(qphy->lane_rst);