From patchwork Sun Oct 20 12:56:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13843060 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76013839E4; Sun, 20 Oct 2024 12:56:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729429005; cv=none; b=YYUe3ZGj7uB+yyXN+dqYnrvnbw2EDtajPkIyrL1qA47VPzq3WpKW0uAEBvgjkQu/37m0Gf3YJ57JdNdePwB2zvqDGsXRkTd2Q4PeMlPWEOoKGbOmHU40eNH+RET95czdKLrNiJlP93Ch+mj9Y7HWZ7SWFOhwGymF0R9gimalGIs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729429005; c=relaxed/simple; bh=wEqYYZq0d5UnakVFln/sc8HZxkPFOy1EiUO2mt6WSMA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dH8tLwCZNg/6jRAiNQl8JQaF3LLM61MEu93AjEPoqE0kXlbaB346J3p42rgbeBF7aeYwOpLkxGHCJX9Xa7cYGZ5QhlYIWzD+mPog1D0yg9vmNA4yy9JfSpy9anBkrAsFFO/VL0HSZ0Wp6jUqjOArQpi7r6Zzza/p0p9uLRKIKRA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=k28lyNVm; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="k28lyNVm" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4314c452180so30773125e9.0; Sun, 20 Oct 2024 05:56:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729429001; x=1730033801; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=8JFvgIdqvXuQshgDFeSzJnog5EipEBYoQ3fcCzur9aQ=; b=k28lyNVmYqPAlDWDN9bNs1sAeLrsmPk+B3mGJLDcpGZ4HARuGSx8eftxwmvyD6h70m 76UYEhjOWDSpvPrM/0/BBUlsg1gG0sF9Oz0BeiNEx8ds+jusrqUjJyntXf+pdSZ0YCyH +2XHYe3kC/yhdko8C2ecvJaNQdrF3HSFjPfjYVRmdWQmPckfVkp8ZWAPZhtRLTFYyGHK InsDfqTw+z8ZX9vRvQsfN5PvxVb/DGAmqCuZJPgDqmvhPcmTDDNu5WMZhzhEQiQnKvDq MOFn3TgCWAwG7mLGmBnlE7snzASSgXFGZ79j4lRE3eoEOThowTQ4v9G2zAGjSQu5mciM jEhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729429001; x=1730033801; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8JFvgIdqvXuQshgDFeSzJnog5EipEBYoQ3fcCzur9aQ=; b=fVAhkT8xvpSo58iyZq13i+eVzWthJ1TbtLw0vrenrIZWYfveMcOc0XzywRqn1GUCXK cRcCxBrEnV80HjGBoQ1QRGteBPSe4vXfi5TrO66tVYmPrrINbcoMu2Jek8tImdrf6t4g 0+Sl9IlsKKRtO1yEyCml/+ue/yv8ry+IfvOA+bXMleQfjVfnOPAwMJMMS+rPCIlLvHAT 7jz3TQaglloFxx5EAtITscxvJvg50Dpaupv8EGIJqVLBhiEhCNkYz5Wr9G6z0ebp6arA +MFb10IernqrmZx/hh+tj0EPas4ciDizA4Sr7+/zViQsJTowElvehhvaAn3UPOeF8Kgf kIJg== X-Forwarded-Encrypted: i=1; AJvYcCVFtfKqHndkr0eLX4ojHRMaeTVsBQCIswLl4JZDeDBIw5e+45ul+5TdU5YoEXLPResGr3mthXbj8vdP@vger.kernel.org, AJvYcCXEVFfzc9fPE0EBIVJfjcV6/pvYkwytbquYBbfqrU9RbBpe6NB0yTYf9DU5mRJY3lBTjtFYwAdR@vger.kernel.org, AJvYcCXtFQrd92kIvOCGnoDqYk21RYfREI3iUC5tVR1SAxM0LHMGZhKM+4wMsVzIlNrCgjswCXj6j7x5mYZBjhM=@vger.kernel.org X-Gm-Message-State: AOJu0YzAIAm10WbhHuc3HqI2duIolhJE2mF8ifLCo1Ordk2wa2ee88pM CLk70E89klaMfYfMbZQgw4XNJNLM7eYAwFuleUvu5XF2gtE6YxLAFtb2jT8X X-Google-Smtp-Source: AGHT+IGKNGNqEY1E6QcN2HUxyiodyMdxTcNfE4Wkz06wY8Phia9k9TfYBwgFT1qzBrsjin79IoPLSg== X-Received: by 2002:a05:600c:3546:b0:42c:b54c:a6d7 with SMTP id 5b1f17b1804b1-43158756e2emr81873555e9.14.1729429000982; Sun, 20 Oct 2024 05:56:40 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-5fe4-91f7-fa4f-9c21.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:5fe4:91f7:fa4f:9c21]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4316f57fe00sm23010755e9.20.2024.10.20.05.56.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Oct 2024 05:56:39 -0700 (PDT) From: Javier Carrasco Date: Sun, 20 Oct 2024 14:56:34 +0200 Subject: [PATCH v2 1/2] usb: typec: qcom-pmic-typec: use fwnode_handle_put() to release fwnodes Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241020-qcom_pmic_typec-fwnode_remove-v2-1-7054f3d2e215@gmail.com> References: <20241020-qcom_pmic_typec-fwnode_remove-v2-0-7054f3d2e215@gmail.com> In-Reply-To: <20241020-qcom_pmic_typec-fwnode_remove-v2-0-7054f3d2e215@gmail.com> To: Bryan O'Donoghue , Heikki Krogerus , Greg Kroah-Hartman , Dmitry Baryshkov , Caleb Connolly , Guenter Roeck Cc: linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco , stable@vger.kernel.org X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1729428996; l=1561; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=wEqYYZq0d5UnakVFln/sc8HZxkPFOy1EiUO2mt6WSMA=; b=XUSPo8a+kAXSuJkrAATrt/JgB37q8aO3qW/6/KHDB8NzdGZ+RBB8hyXjFgUaMwhPUcwqT5znl +X8p7LTColhBkaEfrXdL49HvfJSEd0pSETH87R1zbNVnbM/ndnecpgg X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= The right function to release a fwnode acquired via device_get_named_child_node() is fwnode_handle_put(), and not fwnode_remove_software_node(), as no software node is being handled. Replace the calls to fwnode_remove_software_node() with fwnode_handle_put() in qcom_pmic_typec_probe() and qcom_pmic_typec_remove(). Cc: stable@vger.kernel.org Fixes: a4422ff22142 ("usb: typec: qcom: Add Qualcomm PMIC Type-C driver") Suggested-by: Dmitry Baryshkov Signed-off-by: Javier Carrasco Reviewed-by: Dmitry Baryshkov Acked-by: Bryan O'Donoghue Reviewed-by: Heikki Krogerus --- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c index 2201eeae5a99..73a159e67ec2 100644 --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c @@ -123,7 +123,7 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev) port_unregister: tcpm_unregister_port(tcpm->tcpm_port); fwnode_remove: - fwnode_remove_software_node(tcpm->tcpc.fwnode); + fwnode_handle_put(tcpm->tcpc.fwnode); return ret; } @@ -135,7 +135,7 @@ static void qcom_pmic_typec_remove(struct platform_device *pdev) tcpm->pdphy_stop(tcpm); tcpm->port_stop(tcpm); tcpm_unregister_port(tcpm->tcpm_port); - fwnode_remove_software_node(tcpm->tcpc.fwnode); + fwnode_handle_put(tcpm->tcpc.fwnode); } static const struct pmic_typec_resources pm8150b_typec_res = { From patchwork Sun Oct 20 12:56:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13843061 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 565E1192D87; Sun, 20 Oct 2024 12:56:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729429007; cv=none; b=IS+FpKE1jiBJMzW/OTSZIKeTry+6CfpoIlS30r+Hzo0NcAU5Wvb7w8Ocej1xLlqt7v7TNzrLG6KMnAyOIYprfv/FBwz7cR0OxjBHO4Bxg6WzAPmsHd/n4lZYKgy2bq08NV9+M9PPZyzAutO3vnh7x2//g8O61dDLhyjLmsjEVxQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729429007; c=relaxed/simple; bh=UlTDYWZVsPjmFXqO3SuPTCeEP1M0s4v2VqV1L8OcrJ0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NvLwi3FPjig1AGzwAr16GRWF3gqW5oiVIJe6qHBvKmy8i3UqrOlaY9xSXlZ8BZ2LFh3jx4T8WAF53wBe3sDIQjbpNEyskoYBHgKX5Y0rH72cbZNr38LxH8kz/FSvlQ1RJ5ULW41z1bwHPGck8Ft2Bs9emlz0aVZLWxQcHZZ/G7A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fHMg+Ibj; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fHMg+Ibj" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-43158625112so34611825e9.3; Sun, 20 Oct 2024 05:56:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729429003; x=1730033803; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=oDGKjKx/RHrvUZiVAr/5RFcyku1oUCaohmQwoCH6bXE=; b=fHMg+Ibjue1aenv7UspJgM76LTa0CL8Ab2gMeo/uf1MOAp56byJSoRcROXYExByDvP D35PGyx13dVVpnqzTFyYd23MgME+g8zt4CJEw08mmUc9o9G7E+GnWqm/gFC3LrB56w7m hIAQkPWA0IuKYNa0rlT5PxQGZ3J9BFWs1gKR08YUP4sxXFjxnNcycnqJwZvBsRccRZs+ 4RitlJwZB8Ua9jhw4QKUGzb3Se0XdbZx4fQ4BggDcCC1nJpLaI6pi93hz9Nvej/EpPT8 uZr5MokhSSPhDsCBXqX9IO9OAR3KRp/QkfGdqhI70U4VaQzaWpYgTMAfDN49Sku+nDTe lAwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729429003; x=1730033803; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oDGKjKx/RHrvUZiVAr/5RFcyku1oUCaohmQwoCH6bXE=; b=UX+BOJI7XQ1LjYYGGifiAVBQC4YB6VsHhnEg67ftn5anT0Ur7ZOsYksb+XYtkKtFMS S/dYbHCtiiqQm45yDzGkayHHVm7Dp7nidevFr8sGzRcKaqbv4G4lhtH5Q/hudw3S1PwJ Nqkm8oK2xCSSArr1xitjlKxSHAHL+X/ue1gDWBnCUg3jGzKDZkD1FujarYJX+zjtf/t2 gsu4/WoYIGU4X/POVcBBbo0dOG0ILjcsarU4OfGLs5VGIaR5h3wXZnZfnpRrzf4nUYq7 FT/8rCdDGwm+6dq6aJLZk485rIPOnQc+Wvpnr39WTMORR+67PuToPniwOZnWZShRSnQ0 BQaQ== X-Forwarded-Encrypted: i=1; AJvYcCVKw/ggI42bh8ftn3R1pXVMiHS1RoJArmFwjn0exgYCq2TZWWWqv+LEzrr7LtuN8CCR6xMC7Su7@vger.kernel.org, AJvYcCVZnI2mKb0krzai+lLTvbuHWAwGwWIN0Mpi1Ede5YlRrI8PFOi8j20W+b5SYn/Ov0p08gh+FbMW/6Ey@vger.kernel.org, AJvYcCXSmVMOQNxkV+/ZAXY0BYzhHCcOAaD3QC40SMKDM2h8EzgSKMlcvw6CodJToaLpdo5hVe9Jr7oLuppwJN0=@vger.kernel.org X-Gm-Message-State: AOJu0Yz7vly+lvAiNytoNCksgmXF79zoD7p9KA5rdbnWiQNP6o4x4fHp 7h0a4WF1hQPocBuio/OeWTDI/Jj3xOv+rfsN5E19AYaFJv6m3wcRxg1FYOBW X-Google-Smtp-Source: AGHT+IE6u6+iI/Gmf76CwKGO0v/6Wqkc1oAzj5zIWD5wrVd1yU38i/mMS/GCJ/xijz9k2kT8i/jyeg== X-Received: by 2002:a05:600c:3592:b0:431:586e:7e7 with SMTP id 5b1f17b1804b1-43161634f28mr65353065e9.1.1729429002910; Sun, 20 Oct 2024 05:56:42 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-5fe4-91f7-fa4f-9c21.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:5fe4:91f7:fa4f:9c21]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4316f57fe00sm23010755e9.20.2024.10.20.05.56.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Oct 2024 05:56:42 -0700 (PDT) From: Javier Carrasco Date: Sun, 20 Oct 2024 14:56:35 +0200 Subject: [PATCH v2 2/2] usb: typec: qcom-pmic-typec: fix missing fwnode removal in error path Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241020-qcom_pmic_typec-fwnode_remove-v2-2-7054f3d2e215@gmail.com> References: <20241020-qcom_pmic_typec-fwnode_remove-v2-0-7054f3d2e215@gmail.com> In-Reply-To: <20241020-qcom_pmic_typec-fwnode_remove-v2-0-7054f3d2e215@gmail.com> To: Bryan O'Donoghue , Heikki Krogerus , Greg Kroah-Hartman , Dmitry Baryshkov , Caleb Connolly , Guenter Roeck Cc: linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco , stable@vger.kernel.org X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1729428996; l=1282; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=UlTDYWZVsPjmFXqO3SuPTCeEP1M0s4v2VqV1L8OcrJ0=; b=yj+qfs4BY5cWpTg2VSEdKCRIJIqlhUmi9BfW2D40RyfMwQy6UtY9S9XSJKEMFrlJnxaLfmvgM fheWUnR655RDk74d/hJZ591Ylz2t5YhDvKCnyDNIZEZ/0+KdKufUoTo X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= If drm_dp_hpd_bridge_register() fails, the probe function returns without removing the fwnode via fwnode_handle_put(), leaking the resource. Jump to fwnode_remove if drm_dp_hpd_bridge_register() fails to remove the fwnode acquired with device_get_named_child_node(). Cc: stable@vger.kernel.org Fixes: 7d9f1b72b296 ("usb: typec: qcom-pmic-typec: switch to DRM_AUX_HPD_BRIDGE") Signed-off-by: Javier Carrasco Reviewed-by: Dmitry Baryshkov Acked-by: Bryan O'Donoghue Reviewed-by: Heikki Krogerus --- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c index 73a159e67ec2..3766790c1548 100644 --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c @@ -93,8 +93,10 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev) return -EINVAL; bridge_dev = devm_drm_dp_hpd_bridge_alloc(tcpm->dev, to_of_node(tcpm->tcpc.fwnode)); - if (IS_ERR(bridge_dev)) - return PTR_ERR(bridge_dev); + if (IS_ERR(bridge_dev)) { + ret = PTR_ERR(bridge_dev); + goto fwnode_remove; + } tcpm->tcpm_port = tcpm_register_port(tcpm->dev, &tcpm->tcpc); if (IS_ERR(tcpm->tcpm_port)) {