From nobody Sat Jul 25 02:11:44 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD4B6432BD8 for ; Mon, 20 Jul 2026 14:53:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784559220; cv=none; b=S0Ge0I0fXm+fbI64DllqUNLz923OGjM0floJgUkVlc/75+hAz9Ru+S5ThLH0n2a5dZY1T71GeOG9aU/4zHj6rk3gF5N7ba2w90gNrai9kNiWOLqA8wDbz/rxw9j3UyotVCWbE8aLkVNDbePvuMQmKsWqJdExMsgkqvz2Ex+H8/M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784559220; c=relaxed/simple; bh=0fg/0n8jqlk1rTqLof5aMrLhYmwz4Lkt27r4G+FR9W8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JyIQiuyoFb5efuuEBSVSWLPyF65HFM9yXR1aLs7AaPV0njWvTRkH5zlI9WrTapGecRndFKVF3FeN5dDls9ApVIvtzrG8w2K7rUkD1n6fBBenwp5KD/Ahr65+sR1RO4kLAyYZQuJ/+Cz2HpZsOJJSQgIYmjHisWpvLu4J3wbYq7c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=GSCuJsAV; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=JIPVw22r; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="GSCuJsAV"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="JIPVw22r" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66KDrMk72841191 for ; Mon, 20 Jul 2026 14:53:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 0C9IgCI2fyKGPwADUG81tMOL7Xd+RLAneLurfpmZbVM=; b=GSCuJsAVYE1K8vDn OVNGFExSsfoLCrFtgzJFwhMMtO6HkPpbSJu1PoiI+pDpyAyFCakj+X4esPeSB0uZ L/UKIB4GrJiwZrFmSpv6+WPxp2AwGE6vvKHI+7xowzNP7nSnZPP+Dq6sgvDHiSOz gOFaaNKFRw/KBqO/xwEC6C/05pggELsSB6IXh4WUT03NnS9CyIOuww6729SXe3HL GL3y6e8ynO3JKpa+ca0FTAG7+tRp1P5UB4gFMUc0A6X3b/3GFdrP+FIq4lvXVqcM YguHeeLu1GMhfP57sRDzGudRrf+CDYJISz3xSRzaQZ4Wwl130LGL4oiZOQeqbNlM Q54hkA== Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fhfvxhsms-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 20 Jul 2026 14:53:36 +0000 (GMT) Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-51c1c7f135bso142102331cf.0 for ; Mon, 20 Jul 2026 07:53:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784559216; x=1785164016; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=0C9IgCI2fyKGPwADUG81tMOL7Xd+RLAneLurfpmZbVM=; b=JIPVw22r8JSuq43WIrveNv+PHhQi2MQ3HPSrEgGhX7tLhjCQrSjszKCW1Sgo0sJoB/ 4Z+akTMRHSYyt0QnKYoHTBprAVgBMDSkEpN6xT0nzGEaStf1fllv013lnLxhXkHEsO9L 4fjrzxpGLxTQZMCQmhfSYUkphMJx0GKFjnSaO6+dOKjEJLbapjlWI8IsfeRn1CAHpvzM O4JcYlEGzx9eqqLsB9TdRC2ULp8Wl7+Eh5QHuG29KXNIYQQk4xR413kDNcqeiZSKBdr2 buU7M5Sh8ScXxxcQ6wBZBhpA0IL6pKIasBa+36LEhGi8kP3iGZYePfbw7TRfUzP/FrL5 bhpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784559216; x=1785164016; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=0C9IgCI2fyKGPwADUG81tMOL7Xd+RLAneLurfpmZbVM=; b=Owu5DHRFlXJbY/fPDBVjIFK/25vUsP8wQn9ABNJer0E8o1RpjfDz4zWY3B5Qv0W90Q X0e1BgGRiqZBZNn/C8piA7d17fVUHbTHuh5uBrbsVvQWkVerB8qQOF/h39S3b1ANo9DG j9wEV/sezZAnol10zD7Z+4x3cLroO1z+UwoBDja/3fUotl5lrX09HdDerg9uRb2Tq7b5 QDHmygW702Kruacgz7gQ4qfqzjL5PYGiuGPvaiVc6iJmhW/P+FjHtVamwmsSpqQ7LOc9 KXvfEVCvu8KS2n3clzeXZfyqC9LMoe/o4gA8Ms4yfIDEW+ko347Q75x/6a4AJJT/BI57 4hcg== X-Forwarded-Encrypted: i=1; AHgh+Ro33tR+/yqUqoTE3sarsPUnhUsdjQc2kx5IjkTwLKwNxzqnU2dVhoxRSD6JymDkmWB/6zyyoNwSEbsRhY8=@vger.kernel.org X-Gm-Message-State: AOJu0YxUPuquxow3fY1HXYUl3ipk99fQEq3X9D8zDpoJTofdqkneNkJj ggcbVcVpG7p/qYtOuTZzc5woxXMux5xQU3aferEgfpvF86eyw+N3kvPOq98QoLwtpM2tqJyG++/ ZuSeElALDOz5i/AdbFAJDF2oSaxND7VfSKkR0jgIJNHSuUqQyPPukUQ1loDSx+gbKOXo= X-Gm-Gg: AfdE7cnS0bjF8YWlBs5H2g0mRqacqwkxJuJLTjpupgcXaXf6S1prL58eK0e82FauiMX 98QGXFJMWtixdntBNC/CQa+VQD3XVBs5u3057wbwNcMLl4MEfyUQFV48TSVbf29JUEQY58LIip3 E9Nbhwo8rjOuHe5aKc1SWIPl4SzatEHRTqtZGeqjghe6cuyfN0xXWFK7XRpRfR6mAJdJAKRdxxM LuBHpq3uEHDkKF22CVL3XLBb9k48QYLpXAxpJibA3KWc7h/cyctAWKtMErOu7M/yFQHqYxASID+ gT4eI+b2YxSaTUFfNAaGiNwA7mXGK5b83KaHJQD5OCCUToGkmBt+17q0OjR19/cPmZF2MRq6lyj CTsAxNHliFwv3rN607YCpFb+3uyVCOiU4BqZX/BqRvAgC5+cLRSg5fyGEJkwPwPax97l3xTV7A7 XfZ0024JcwCW/6CjPEUIt8npSnUITdiOBXzYrA9ti9H58u0fnoj5w= X-Received: by 2002:a05:622a:4110:b0:51a:8b64:69e0 with SMTP id d75a77b69052e-5213d2b7109mr134941901cf.11.1784559215693; Mon, 20 Jul 2026 07:53:35 -0700 (PDT) X-Received: by 2002:a05:622a:4110:b0:51a:8b64:69e0 with SMTP id d75a77b69052e-5213d2b7109mr134941511cf.11.1784559215166; Mon, 20 Jul 2026 07:53:35 -0700 (PDT) Received: from QCOM-eG0v1AUPpu.na.qualcomm.com ([2a01:e0a:830:450:751c:d61c:c91:60dd]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-69e7000c3e2sm4800215a12.30.2026.07.20.07.53.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2026 07:53:33 -0700 (PDT) From: Loic Poulain Date: Mon, 20 Jul 2026 16:53:30 +0200 Subject: [PATCH v4 1/4] phy: qcom: qmp-combo: Prevent unnecessary PM runtime suspend at boot Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260720-qcom-usb-phy-fix-null-v4-1-4d2a0f06d53a@oss.qualcomm.com> References: <20260720-qcom-usb-phy-fix-null-v4-0-4d2a0f06d53a@oss.qualcomm.com> In-Reply-To: <20260720-qcom-usb-phy-fix-null-v4-0-4d2a0f06d53a@oss.qualcomm.com> To: Vinod Koul , Neil Armstrong , Dmitry Baryshkov , Wesley Cheng Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Dmitry Baryshkov , Abel Vesa , Konrad Dybcio , Loic Poulain X-Mailer: b4 0.14.2 X-Authority-Analysis: v=2.4 cv=HKLz0Itv c=1 sm=1 tr=0 ts=6a5e3670 cx=c_pps a=WeENfcodrlLV9YRTxbY/uA==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=PcYcMbZi39MCwOMHHM8A:9 a=QEXdDO2ut3YA:10 a=kacYvNCVWA4VmyqE58fU:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIwMDE2NSBTYWx0ZWRfX5iT9uHI0Dfgv OkVVu73PL5xWa7ziCOb6oKNKWy1gL7tBYT+wd7lfOXUqMhitkNKWNddll7EjaoDDg5Ywzav+E83 L98t1qlCw2k2q1YTJbTQjFKqT09flJ0= X-Proofpoint-GUID: qJYK86CRp6q874uQmMSDiHu7reGd04Dj X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIwMDE2NSBTYWx0ZWRfXzksoEpGkPnY/ 76StYtrj8FKmC+9J2FVHCYFtCnKz/vJ0lPRxfusK9+Gd/97zG5TKt6xM+ng0v3s6jSYvS1vObTn ARvJY9FQtpxM7wFiUYacuXgXIw+iDEsia54laOBa8yf81vikzU6VJpB8bXGX75VN8vLNGcPmH2e beC/m5ss4Fo+fw79OamV15zrkNYq5c47jz1eMII07rHP1VVSR4CHcQn9dxFCbbjfz0BMF+IbFMV udOUnVzyzCKEI9gVJgi1XGWK7VyMxG8KJh9LNt59Mp1d3nGjf3DGvdz39PBWrDS3EvxJDlVvXPt pNGxBgE31ccfUMUUag5YIRQgRYXJV1pk2Wyps/+aF5xYRPiVmZo3soy3O52Cz4gqMbSwc0g0IqS pAXHADbIyTZaDGALg5Y+Lv80C9tXUqkPp81zjDztQKQGNmRQ0UjnD+CUDxmzzFVEaSj1WGjgP/t kVSBk6n0vPBdyYZAT3w== X-Proofpoint-ORIG-GUID: qJYK86CRp6q874uQmMSDiHu7reGd04Dj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-20_03,2026-07-20_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 clxscore=1015 malwarescore=0 bulkscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 priorityscore=1501 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607200165 Runtime PM has to be enabled before creating the PHYs, since phy_create() only enables runtime PM on the PHY devices if it is already enabled on this parent device. This opens a small window where the device can be runtime suspended after pm_runtime_enable() and before the later pm_runtime_forbid(), causing an unnecessary suspend/resume cycle while the PHYs are not yet registered. Take a runtime PM usage reference with pm_runtime_get_noresume() before enabling runtime PM and release it once the PHYs have been created to prevent the device from being runtime suspended during that window. Reviewed-by: Dmitry Baryshkov Reviewed-by: Abel Vesa Reviewed-by: Konrad Dybcio Signed-off-by: Loic Poulain --- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualco= mm/phy-qcom-qmp-combo.c index cdcfad2e86b1d37650c4d7b0433319837ee9c9d4..affc8e040bb968a5b9d0b6f6fc2= 694c471368729 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c @@ -4934,10 +4934,16 @@ static int qmp_combo_probe(struct platform_device *= pdev) if (ret) goto err_node_put; =20 + /* + * Enable runtime PM before creating the PHYs, phy_create() only enables + * it on the PHY devices if already enabled on the parent. Hold a usage + * reference so callbacks cannot run until the PHY is ready. + */ + pm_runtime_get_noresume(dev); pm_runtime_set_active(dev); ret =3D devm_pm_runtime_enable(dev); if (ret) - goto err_node_put; + goto err_pm_put; /* * Prevent runtime pm from being ON by default. Users can enable * it using power/control in sysfs. @@ -4946,14 +4952,13 @@ static int qmp_combo_probe(struct platform_device *= pdev) =20 ret =3D qmp_combo_register_clocks(qmp, usb_np, dp_np); if (ret) - goto err_node_put; - + goto err_pm_put; =20 qmp->usb_phy =3D devm_phy_create(dev, usb_np, &qmp_combo_usb_phy_ops); if (IS_ERR(qmp->usb_phy)) { ret =3D PTR_ERR(qmp->usb_phy); dev_err(dev, "failed to create USB PHY: %d\n", ret); - goto err_node_put; + goto err_pm_put; } =20 phy_set_drvdata(qmp->usb_phy, qmp); @@ -4962,11 +4967,13 @@ static int qmp_combo_probe(struct platform_device *= pdev) if (IS_ERR(qmp->dp_phy)) { ret =3D PTR_ERR(qmp->dp_phy); dev_err(dev, "failed to create DP PHY: %d\n", ret); - goto err_node_put; + goto err_pm_put; } =20 phy_set_drvdata(qmp->dp_phy, qmp); =20 + pm_runtime_put(dev); + if (usb_np =3D=3D dev->of_node) phy_provider =3D devm_of_phy_provider_register(dev, qmp_combo_phy_xlate); else @@ -4977,6 +4984,8 @@ static int qmp_combo_probe(struct platform_device *pd= ev) =20 return PTR_ERR_OR_ZERO(phy_provider); =20 +err_pm_put: + pm_runtime_put_noidle(dev); err_node_put: of_node_put(usb_np); of_node_put(dp_np); --=20 2.34.1 From nobody Sat Jul 25 02:11:44 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6C67432BF9 for ; Mon, 20 Jul 2026 14:53:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784559221; cv=none; b=F7XJclwWRczsMSTMFjvDS15IywxBVpmcyzQwPK2k6mYThq9Xfik9xGrezSODRuEWAjmva8h1i2VwQD60/NB1LScDzMeRSvJ05wWXnUybAARCA2xG51En0oM3GRvF44EL20tqIJj5ANMtccrehSS1GYCJ8eGw1CedvxFX0lTytSg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784559221; c=relaxed/simple; bh=nUtpxxuiRb+RaL50EhMrsJJovCVCQ1vnB/0Y5yFR1yQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uOU2jrB2TsvRbRRHpJFP6LouPXi9kDrpWRfCALK0wX030gkNBpt8puC9zZ5jKuHLqVYLD63YDyOry35mFZZOZkDVmP7A4j4TL7pPAJ/gfGo40fCbZuNXzOwmy3QzcTeO5m0r5h6LcC0yWvW0sfRQpr+gGN2TQjm25vfZ2Lcyy7I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=HSZCvTPv; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=ALOgQmWz; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="HSZCvTPv"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="ALOgQmWz" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66KDrASv3859382 for ; Mon, 20 Jul 2026 14:53:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= jdHltSsSc1HthVrTabB7Rd4UqHGUwTwsmtUtkd1pIoo=; b=HSZCvTPvExHmjjhK O1b4JPRoPIOquA/j4h+RbIRO5GY2/C4JIQ4fp448fuQJsbSy61wmx46+R/+vCzDJ pOQNi/+TgPIBPSsuU/7X4Pq7SqBH2G01ci/+tIMnyqv8yo3ZdqJzHbht0OjuY4FZ jr+30eO5/PAp/dja+Zc0xdQxBUf+cfTGLW8+KUrtmPkKj0N/untBxPK+Jpy19cFZ 0jEOJF+bIECaTJUF1OvVeCbkWG/VOs2B0e8yueduWkrZp8j/dT1LM5+DUDbOFuM1 xIksRhkKaMreo+33IUXyT0XGUCiVofYm5pnHCyoGraN2pGU8IwmzZSOYeKft0r5P ijU/7w== Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fhfpg1v7r-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 20 Jul 2026 14:53:39 +0000 (GMT) Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-51c083f1818so130915401cf.0 for ; Mon, 20 Jul 2026 07:53:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784559218; x=1785164018; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=jdHltSsSc1HthVrTabB7Rd4UqHGUwTwsmtUtkd1pIoo=; b=ALOgQmWz6Xu2JZmdDRhjBGixUKEa15vYFd3Pw62guglErE87iQ3Yo4tpYnTKs0CoXt vkhPDbfV18mnAG+MnaeMbkz+ZBXJljEF79zB1WqGDuSSHLQP4lzHMoPw1i1V00WRW5yS oC5zzgoBRisAW6f6kpejREkWy2LLN5KfjcHCqyTuK4OtA86HHY3JIgYOni96SsYpNduS PBiBccirPv8fSEK/9xUxX9BUlQgve0Vyoj5o6hQm6f/jhNCxISj03RjCg1G+9KJyB4cs IR8lqlGsu9snew1DMOvh4O9cHVP/iftQ19Wl0bOEeTyIX6RQ4Erq10e5XQ4NuQSJ+HyQ sjVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784559218; x=1785164018; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=jdHltSsSc1HthVrTabB7Rd4UqHGUwTwsmtUtkd1pIoo=; b=iRg+x5eq1FLIGgbfpJjdwdSKQWWZkg9FkCOiEhrFAlvBpJ8woHrZ1tJab4nfSf4fB7 wCsUjzNuVpqHwelKrw1UG83YgoA8SayOD5fL5LklVoykswfVLn7cqV9vDddjILdiflAL LdyX74Lx3GuTGLpcCTUOCCE0TB+9TDKoOUIHIOQ7LzGN/lbgMkrlcAxpxp0wdNMTIveY v50y2eDQ7hFAZLeWEamw8YISvc/a+5AIu5ShDZs2n4hsrH2TSfWvKlvpIs6qMTaEzOiq gOIrlmEFzHATiigi8HQVRib+HiacMXqC9oO+QhSXvwsHu+SjAYbnl7gcO9NERSUVREs0 Zc/A== X-Forwarded-Encrypted: i=1; AHgh+Rpa+04lriPlOfhK0VE1B2gHKYExueEJ5a41Cl66o9h1HtOcGF5U5Y5d2BwMvmfSI5ArhWzJqPQ9ACn2V/I=@vger.kernel.org X-Gm-Message-State: AOJu0YyOEf8gdoRxRBN+JElm0sr0WZ+0HCx23w248HjqdAFpldauvAPA NGkir5lrNApek0MKBKM1H66Dlb4jYY1bcVeNg2unLotIYunKsFqIURCgjTuy5C78KHqcnIc/h6A SXjkSEJz/B5H3aTkDWyMQcCwGCwVy4+x3j+an+Ks42GziCdVlNnz7++9kh7yutUC/SWw= X-Gm-Gg: AfdE7cnq2KR1pa8cQGqRybp/hdMUmWaEysfOp0uCmz+G19Xd7kM0TLjHtYhiSjVKHt5 l9aj0vnBhdqLR0WIoRETSRctsTgSxhsP8trfUF0ApwA3yy6vSWapR/+S5niK58EV2urX9tmOe8S StqGWIciDCUC3qThPwBaXL18PSz3qrJOmY93/vyTrEAvo0GJeiiucCP5qs4Tm2pd+IGGuHL2UG9 Byv1+KOtmc+x3LmydUyy4g2HZX3jxutEzUkmGYjTk3Dl70Rjwr7fxEY0zA6n/UthnKVebi7Mp7F mI9MXuIDtfzv99BNeGY1Fkq07rCp1B/y/HbMCnCfR+Ut8btWJ9pSB4y/uMlTa8qpHyMoZKVEFuX VJIFBf1/okyvW4cWWYxg9ShcCgtUiWELhj9YKuwggj0hmfMpBH/kL7acXGWwkiWyKkGk6Cu4y4y XBjRn3HGX21jBr6a8QkvvOeamFM3+6qZLLv1nM7i8Qkq26XvuNSbs= X-Received: by 2002:ac8:5809:0:b0:51c:709:b81c with SMTP id d75a77b69052e-5213b1494c9mr137954361cf.32.1784559217854; Mon, 20 Jul 2026 07:53:37 -0700 (PDT) X-Received: by 2002:ac8:5809:0:b0:51c:709:b81c with SMTP id d75a77b69052e-5213b1494c9mr137954111cf.32.1784559217346; Mon, 20 Jul 2026 07:53:37 -0700 (PDT) Received: from QCOM-eG0v1AUPpu.na.qualcomm.com ([2a01:e0a:830:450:751c:d61c:c91:60dd]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-69e7000c3e2sm4800215a12.30.2026.07.20.07.53.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2026 07:53:35 -0700 (PDT) From: Loic Poulain Date: Mon, 20 Jul 2026 16:53:31 +0200 Subject: [PATCH v4 2/4] phy: qcom: qmp-usbc: Prevent unnecessary PM runtime suspend at boot Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260720-qcom-usb-phy-fix-null-v4-2-4d2a0f06d53a@oss.qualcomm.com> References: <20260720-qcom-usb-phy-fix-null-v4-0-4d2a0f06d53a@oss.qualcomm.com> In-Reply-To: <20260720-qcom-usb-phy-fix-null-v4-0-4d2a0f06d53a@oss.qualcomm.com> To: Vinod Koul , Neil Armstrong , Dmitry Baryshkov , Wesley Cheng Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Loic Poulain , Konrad Dybcio , Abel Vesa X-Mailer: b4 0.14.2 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIwMDE2NSBTYWx0ZWRfX6NAFxPNS5bT3 P4OsNd01P8Wbbc3V5Nd5xKeWPeF8dMGBoXTCY52AHB+8XfX6SVfecPoanlVS80IcjUprcZxn4bc VHEsJIeW2IlEBrVozPjc4jsGxdZ9JHQ= X-Proofpoint-GUID: Uz6eymw7ETaW68Ok03_SFaXHgOVWD4X4 X-Proofpoint-ORIG-GUID: Uz6eymw7ETaW68Ok03_SFaXHgOVWD4X4 X-Authority-Analysis: v=2.4 cv=c+6bhx9l c=1 sm=1 tr=0 ts=6a5e3673 cx=c_pps a=WeENfcodrlLV9YRTxbY/uA==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=PcYcMbZi39MCwOMHHM8A:9 a=QEXdDO2ut3YA:10 a=kacYvNCVWA4VmyqE58fU:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIwMDE2NSBTYWx0ZWRfX70xGjvlDJyEC OFg9ev1WfpQ6RkTgeNkKz7Txh1H/Fbm7BRRZhc0msh2KCYCySuHcVq9jvxPZ/ChsgXGWs8DxpGG UNmBqB4tkQxb1b9Tmi9Ynhx0n6Nf1GTS1RZXS9+srOEXScWwoIWIrTAnzuEcoBX9gk0y4TuRnBS JYd12dQexqxKKM/lFX7/N9Ot7voYR6iJXX6NtlYTHYSZ4yVJV/WVCvCnOya0Z1EpCkpOglHYTfc 4zT423yDwi9kRi9kLlLK2lbBQYL8G22yOt6Wy4whS9LtN12Hi3EDd3CY0mwzL5h8LC4/ngca2Fj JQYBMqdFBj8E7xvlqAkAMMX2jRGnfDaQTSUKNQGzABHC7JcM6iHSM8kfq8Lc5nRH3hwtk/4Ea+W G2mf1A6LACHUdgNcDdQIO7EdxBt05ivDOPf5kwBKRGcMHzKVSCjMV7yxdPt6SS4bIeRvJpNkotj 38HpIKe5KorEvZcWYFg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-20_03,2026-07-20_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 impostorscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607200165 Runtime PM has to be enabled before creating the PHYs, since phy_create() only enables runtime PM on the PHY devices if it is already enabled on this parent device. This opens a small window where the device can be runtime suspended after pm_runtime_enable() and before the later pm_runtime_forbid(), causing an unnecessary suspend/resume cycle while the PHYs are not yet registered. Take a runtime PM usage reference with pm_runtime_get_noresume() before enabling runtime PM and release it once the PHYs have been created to prevent the device from being runtime suspended during that window. Signed-off-by: Loic Poulain Reviewed-by: Konrad Dybcio Reviewed-by: Abel Vesa --- drivers/phy/qualcomm/phy-qcom-qmp-usbc.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c b/drivers/phy/qualcom= m/phy-qcom-qmp-usbc.c index ab3055bb5b0c198832ae06dfcd04fd34395e271d..4317224070fd8dec98090e9200a= c7d0e97265979 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c @@ -1959,10 +1959,16 @@ static int qmp_usbc_probe(struct platform_device *p= dev) if (ret) goto err_node_put; =20 + /* + * Enable runtime PM before creating the PHYs, phy_create() only enables + * it on the PHY devices if already enabled on the parent. Hold a usage + * reference so callbacks cannot run until the PHY is ready. + */ + pm_runtime_get_noresume(dev); pm_runtime_set_active(dev); ret =3D devm_pm_runtime_enable(dev); if (ret) - goto err_node_put; + goto err_pm_put; /* * Prevent runtime pm from being ON by default. Users can enable * it using power/control in sysfs. @@ -1971,13 +1977,13 @@ static int qmp_usbc_probe(struct platform_device *p= dev) =20 ret =3D qmp_usbc_register_clocks(qmp, np); if (ret) - goto err_node_put; + goto err_pm_put; =20 qmp->usb_phy =3D devm_phy_create(dev, np, &qmp_usbc_usb_phy_ops); if (IS_ERR(qmp->usb_phy)) { ret =3D PTR_ERR(qmp->usb_phy); dev_err(dev, "failed to create PHY: %d\n", ret); - goto err_node_put; + goto err_pm_put; } =20 phy_set_drvdata(qmp->usb_phy, qmp); @@ -1987,17 +1993,21 @@ static int qmp_usbc_probe(struct platform_device *p= dev) if (IS_ERR(qmp->dp_phy)) { ret =3D PTR_ERR(qmp->dp_phy); dev_err(dev, "failed to create PHY: %d\n", ret); - goto err_node_put; + goto err_pm_put; } phy_set_drvdata(qmp->dp_phy, qmp); } =20 + pm_runtime_put(dev); + of_node_put(np); =20 phy_provider =3D devm_of_phy_provider_register(dev, qmp_usbc_phy_xlate); =20 return PTR_ERR_OR_ZERO(phy_provider); =20 +err_pm_put: + pm_runtime_put_noidle(dev); err_node_put: of_node_put(np); return ret; --=20 2.34.1 From nobody Sat Jul 25 02:11:44 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 600DA431E69 for ; Mon, 20 Jul 2026 14:53:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784559223; cv=none; b=nAmF/I4m0hX8lXiKkhIpldWUgNLY1Kq9GOr7h+s24IKQIV/gJxAkEohev+guCPiPl/q7LfrYDVkg5+qgOLSebQudmKEJB8wjwmVE2VbcJoFdUAg6w6pD9f+acWBE5F+yN7zbiI/GRGSBJ8aOo9BMNJv5r/rDxuDsXI6G+zTR+fU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784559223; c=relaxed/simple; bh=kEFKGUoElhkuV1SIhUE3nbBGRr9taBnPmKBOso2I/E8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TUQcLvZV5G/1QP+XZV877lCjMUfBomsc8onp0s4F99w33AnXuLvuUhXKUXtfr+MvObn+/w8GaaGBAxkBs1hWwsWWT8SriyuBIsu0FdbtRlvTMVXqtCzVMOi+0WHte2wm5vJah35eGzt8JwUapJ78vuJdiH83raHF8hjd9wMCQ5g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=hkqBA2iw; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=A4CAMsz0; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="hkqBA2iw"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="A4CAMsz0" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66KDqanA2837031 for ; Mon, 20 Jul 2026 14:53:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= L0DjVqpTkuQJo94lpey+cOup2FTxJcwHBbDODt+Htk0=; b=hkqBA2iwVJV91ZFM ht0X7DIXqERCapwkg40bDZ+vs0XyK7uXEWnCfvImyCehkDi/m9fyAIJXTvEqav07 dcOLD9vvVL7VqcqNpwrlKY1ifyynSvWyh1D5ofYrdhKvY2wp/fz7x4rfpFpluDPJ E5hZ8Dku2bhA2PtkqdyDBuSiT2zBjDbPS7B4AFp2YOzI+9FMbRzDQ18GPlQvZf/m kh+NjjBRtL6wNJarWhDo4mDuVJNhlnQzqJfn/BAHLSWgtTtEvtUqF1ALccxiDD0A 81UevLP1r2mAeIBMmpzjTk7M0j5eF8Rv0G2KeNDa+pn6n3kITbKAn5w8na9kokpO mY2x2g== Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fhfvxhsn3-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 20 Jul 2026 14:53:41 +0000 (GMT) Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-51c12e43b98so200597761cf.1 for ; Mon, 20 Jul 2026 07:53:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784559221; x=1785164021; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=L0DjVqpTkuQJo94lpey+cOup2FTxJcwHBbDODt+Htk0=; b=A4CAMsz0SQ77t6JDTJhIg5u96rh9KaAz4Aw9W+UCxTZSeFNDbcSwLx9S7/nDTeo0X0 1YbLnvI2mbj9pqd3NJjm0BBVAK3idfkaTxbZepeaApDhiZzFlXNDaF3S8iH9ch6d2Ls6 ppon5ODvPt7np8+8NfWqfZzGfPpyq0BWbyDutkrdrezMViVJHGFvgtp9fDu9YBbqKkEq BScql5U2NJfDCu+KxSICoR/MLsSg/G/aXbwHjrr0bTdumX5jAqJ8bQCf9qSSRoYLFGo5 v7lVDMEh+3lfZTyzU77/3WSBTeBK/sHADCGgS2opFjDacbVrL7WE+pTO30+Z/+AIgqOp BH5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784559221; x=1785164021; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=L0DjVqpTkuQJo94lpey+cOup2FTxJcwHBbDODt+Htk0=; b=sgDiuHkJYuFsPt54coVpE6a1PUg4UaMWRtfE+zF7MmlhE3RTZkMqart4yABCRYBPDJ Rb+gx+1hhagA9iJowVJCM4WrMh+LOJ2l8JmPoK76wX4msuKW9ZmMV/UIDKdgMfIwgccR Cda2cJgwPNdnsmuwNG24LNNMVZkVauybunhysr/lwUNVxdumf5Pk+5H79Vv7FMEl7tRz f4Z0gksXsqxxkDlD1lfjJCxcRwi3IJbgyDS8NeEROf0QMmxfMGHpe5eG+KEd5JWjQE/X K+bjSYM592kHxEK2d+iM7anu7YhiWefo/XhHGfEhVZb4+mc+205HeIJWuIfGE8qbw50L 6wSg== X-Forwarded-Encrypted: i=1; AHgh+RrX6U3qNBoIcLQVMSaly7XYv6CFZoDPcvNnFMwTCNn+7TO4oNPjQAeVk6bTttVcYSneCM6cbzr2OvJ0mjU=@vger.kernel.org X-Gm-Message-State: AOJu0YwX+dDAeH9H5U+C8VjYroZHzjCu9JB6hGW/aHhenq4V66EyKqt+ IVvAW/MbnMyBM8iCrnqvmKuIhESn+rDftYSBuou+FcseMIc1PslDI04YvI+oXIDiGBOpS/hkC3+ fPKQq/zE0BU8db131XXgsHJMhe6zSsuW2cV8FtQxA85JNqxO1JsK/GL3zPqdUvOVsaUI= X-Gm-Gg: AfdE7clKVXtNQI6tSmOtbco8yHOmFnelEsJ8o+MEl8tJnECkEiQ2eFaVYJqvtEyxfk/ 5J2LEs82Nf9PlaiE/Kwf3dSXccM7ajGmyNWgbktI8CZSuIxaew1DtDQGMfLSLPBZMygKSFaLb7h 279K0MkymYf7U6BIMZomOjSu22IkyeVwIs0q8vEStfq07r7fUh1lKMfEjPsJ6zxzgg5MxGNAKET LpGvWP0FCw5bljsF+3n22o0rVcLGWwtXkjc28UEyVMCcc041JAYqgItZWVFzjJx8RufBHaVWQdZ h+AK3h0PsQqZmv4Jc2UwETY+yauN0OU8wdzUNfHx+oWoLeDS6eRwmrwX/B+qUG6YaNU4imOA+Px tOcHM1apo9Z1aqNFB629JxJImKSUtDRpVrd9KVZV8kZwwoHjjBNorQVbuRvPJ9Y5mFcoMsHDhbF vJBxuhHNjuGeSIbx899rJmCE5OPUw7qfI/rSS7sJpOEcwlTt4+X08= X-Received: by 2002:a05:622a:1f91:b0:516:e152:7a59 with SMTP id d75a77b69052e-5213e08256bmr137157431cf.42.1784559220328; Mon, 20 Jul 2026 07:53:40 -0700 (PDT) X-Received: by 2002:a05:622a:1f91:b0:516:e152:7a59 with SMTP id d75a77b69052e-5213e08256bmr137156911cf.42.1784559219566; Mon, 20 Jul 2026 07:53:39 -0700 (PDT) Received: from QCOM-eG0v1AUPpu.na.qualcomm.com ([2a01:e0a:830:450:751c:d61c:c91:60dd]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-69e7000c3e2sm4800215a12.30.2026.07.20.07.53.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2026 07:53:37 -0700 (PDT) From: Loic Poulain Date: Mon, 20 Jul 2026 16:53:32 +0200 Subject: [PATCH v4 3/4] phy: qcom: qmp-usb-legacy: Fix possible NULL-deref on early runtime suspend Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260720-qcom-usb-phy-fix-null-v4-3-4d2a0f06d53a@oss.qualcomm.com> References: <20260720-qcom-usb-phy-fix-null-v4-0-4d2a0f06d53a@oss.qualcomm.com> In-Reply-To: <20260720-qcom-usb-phy-fix-null-v4-0-4d2a0f06d53a@oss.qualcomm.com> To: Vinod Koul , Neil Armstrong , Dmitry Baryshkov , Wesley Cheng Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Abel Vesa , Loic Poulain X-Mailer: b4 0.14.2 X-Authority-Analysis: v=2.4 cv=HKLz0Itv c=1 sm=1 tr=0 ts=6a5e3675 cx=c_pps a=WeENfcodrlLV9YRTxbY/uA==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=PcYcMbZi39MCwOMHHM8A:9 a=QEXdDO2ut3YA:10 a=kacYvNCVWA4VmyqE58fU:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIwMDE2NSBTYWx0ZWRfX6HhykxU6n3qQ 4uVA8PDahcbPhUkfpeLEhG7Me2c9GQvA5btqIvAo6X4XQE1XV26mkqusC27ETMAflliCubGXRNq Wssd6B/RNddVCoYXqeE28YCUZ6O87oI= X-Proofpoint-GUID: N_InJHfThYahAQMVzJzKAWlIaUHH_ZtS X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIwMDE2NSBTYWx0ZWRfX+dGZHTms/e86 OZrZGuIr5L0cHiPHB53PLknYTT5mHAZo9SBtQquVEYmUsVB5HgC9C3R38+pbliRRzLFnKC4MKp2 RrQmi5VXPXmvuswQ8a9IMKdZ5eP6TpUaOcg7pGEAXJOxtf2eriyoaOXjGvsnqOL2vLZXxaoGw/E HIAA0EFV7Hy4XoAxxLXnhQcqqtdtbaJA1hXDbRf+Nf3QRzlE51ZphUR7Hgp8JjfjLL6ykQL5H8S vVBWslM1Uow07DlxVfNk+OXnRlwr0+jIVx+oqHPxN9MMDGc7oRiqPNmxo+0iTS8+bo3Hp406W53 nrO1RzriI8fh1g+lUVlHPoJ/R/fp26SQbpskul7IBOQfOYOexvo3nBhVMCAku398VvX3SBxD+AI zpNhkJV3lntqvvwos/7hKNU0Y1UV7WHgrjmpa8oaBB9+flXC9F7NumbR3/xeGIPwV6hCbJkfqB6 uiztQ/fqn/27E361E3A== X-Proofpoint-ORIG-GUID: N_InJHfThYahAQMVzJzKAWlIaUHH_ZtS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-20_03,2026-07-20_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 clxscore=1015 malwarescore=0 bulkscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 priorityscore=1501 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607200165 Runtime PM has to be enabled before creating the PHY, since phy_create() only enables runtime PM on the PHY device if it is already enabled on this parent device. However, the runtime suspend/resume callbacks dereference the qmp->phy pointer, which is only assigned by devm_phy_create(), later in probe: `if (!qmp->phy->init_count) {` There is thus a small window where the callback may run after pm_runtime_enable() but before qmp->phy is set, dereferencing a NULL pointer. This can also happen if user re-enables runtime-pm via the sysfs attribute before qmp phy is initialized. Take a runtime PM usage reference with pm_runtime_get_noresume() before enabling runtime PM and release it once qmp->phy has been created, so that no runtime suspend can run while the phy pointer is still uninitialized. Fixes: e464a3180a43 ("phy: qcom-qmp-usb: split off the legacy USB+dp_com su= pport") Reviewed-by: Abel Vesa Signed-off-by: Loic Poulain --- drivers/phy/qualcomm/phy-qcom-qmp-usb-legacy.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb-legacy.c b/drivers/phy/q= ualcomm/phy-qcom-qmp-usb-legacy.c index 8bf951b0490cfd811635df8940de1b789e21b46c..8b91eec0b5eee0c76b64e2c2b7a= 15f0169ce4b09 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb-legacy.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb-legacy.c @@ -1277,10 +1277,16 @@ static int qmp_usb_legacy_probe(struct platform_dev= ice *pdev) if (ret) goto err_node_put; =20 + /* + * Enable runtime PM before creating the PHY, phy_create() only enables + * it on the PHY device if already enabled on the parent. Hold a usage + * reference so callbacks cannot run before qmp->phy is assigned. + */ + pm_runtime_get_noresume(dev); pm_runtime_set_active(dev); ret =3D devm_pm_runtime_enable(dev); if (ret) - goto err_node_put; + goto err_pm_put; /* * Prevent runtime pm from being ON by default. Users can enable * it using power/control in sysfs. @@ -1289,23 +1295,27 @@ static int qmp_usb_legacy_probe(struct platform_dev= ice *pdev) =20 ret =3D phy_pipe_clk_register(qmp, np); if (ret) - goto err_node_put; + goto err_pm_put; =20 qmp->phy =3D devm_phy_create(dev, np, &qmp_usb_legacy_phy_ops); if (IS_ERR(qmp->phy)) { ret =3D PTR_ERR(qmp->phy); dev_err(dev, "failed to create PHY: %d\n", ret); - goto err_node_put; + goto err_pm_put; } =20 phy_set_drvdata(qmp->phy, qmp); =20 + pm_runtime_put(dev); + of_node_put(np); =20 phy_provider =3D devm_of_phy_provider_register(dev, of_phy_simple_xlate); =20 return PTR_ERR_OR_ZERO(phy_provider); =20 +err_pm_put: + pm_runtime_put_noidle(dev); err_node_put: of_node_put(np); return ret; --=20 2.34.1 From nobody Sat Jul 25 02:11:44 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 460F93B6344 for ; Mon, 20 Jul 2026 14:53:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784559233; cv=none; b=hoEq2hOFVpnJVog2p7EBhFIBWKy+OoEyPG9weIMlLGp3DMKEhNsp+6XfiZiwxVe7F28aW6zteqgipZISphJiTctFtxxSHWW2oDCDq1ZddRTC59MCcL2yLFevPRBmkw17MJQTdSuWqPQjtoyXdj6/4WkbqqbMZ/LtyvDoG/9M4do= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784559233; c=relaxed/simple; bh=hB43yDM5wPsZ0p8kCzuf9vWRzlFYjXS4Z9sUYHruMMM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Vj0HbZZ+MwslpYDiKtUuZj6kdKw/nUr84cOx7QUcvRJbB8XnWYb7DSSzV5iDWdFvMxl/SWy9bMl3/M/NaYRm4l/axFoP8tN6kFTNtPPsS4/F5WjRIHw7khfhpiNBD3B64N9l3yM3CRfDMLJZQM1NgZdmFHX9wzDQNOE6tBA67Ps= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=jDkujJ+q; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=G8xBFsCF; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="jDkujJ+q"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="G8xBFsCF" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66KDqbSo2962875 for ; Mon, 20 Jul 2026 14:53:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= GXJHlTlWI9rdZAlQlDTbUDpfcsl4EJSlpJT6KPqMdqk=; b=jDkujJ+qSnwsUxBm 1EcSaMqdPQnJdXRSjJ71Vk3+7L4RhU343dllQrDcrJLOLenLM9zvKKfJUwSw6RD+ /jqQo7fJBzIOa/doGt7vuNlKeu6Q/H/LY0VisR0vHWQdpzcowTAPpolv9zjLUZs2 PfJycizd0PLli6LiQjrtsEFGe2LrA+x3qo+QBFTf4bv4R09WmFfvTeEJf3xLZdti dLWtCVWDE3bDG2hmdCckaEeih8xRpLocG1XoCX6FcxvkF+kc/lwQ5h666UeCrvhi bHgAHauRpOe5gxHfJNzn0u7dn+qLMHj+AaiJj9WPiMuPIkhtEUrxOjily4VOihdQ 5dYpOg== Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fhfdchwdc-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 20 Jul 2026 14:53:51 +0000 (GMT) Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-51a8db414c7so170368471cf.0 for ; Mon, 20 Jul 2026 07:53:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784559230; x=1785164030; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=GXJHlTlWI9rdZAlQlDTbUDpfcsl4EJSlpJT6KPqMdqk=; b=G8xBFsCF1foGrYyfqu0mGx3mnvg5QEHcCnFAupDYED4PqOZuybIF/ouVIx1xUVcrK6 Wg5b1CKjUqSYwrUrySvozPgdly5Rq2sPwVbLS0QFqAmBw07BnH5UY8UgM4fxdhkqYJ54 SIBOYt7/6TBdu45IuYUARxUgIb6M7rvNke7/slkFaJ6lXmMdC8fi8yNYUGGpHT1sMClf +7dEzYb+3yzypGi3J+UIYyIYBlzXK6SGKiiYtdGmIouSSwyWgr+1XD4BeEJh4fg9+/FX 6fAs/KvtayOAmR2F88cHo+ah06cPIdjxnuv5C6yEgTnNvXqrsVO8G39bjNj8h+DuqHaG VyBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784559230; x=1785164030; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=GXJHlTlWI9rdZAlQlDTbUDpfcsl4EJSlpJT6KPqMdqk=; b=H76hLQOZzqGEnvJTqMg7tT0b6IEinLQ5OUkq52qikN8JtlLr3ORo5wvK3waDTpgfnX 1bBdkh0yps9iJJPxxRqYrus10gdi+R2xefbYAihB5zJKrrBwlsR8jfag9mtV6d7onbVX SSFPPFzU7mdDTXJn8tda1wCL0XGRu6nTOo3GR+TGg+h2jqKkygQAb5c2V5vevhs4aAAh Y4w6xKKa55uSYtIpcOMLfGqVe3XPsxUslFC0eeGeFU3awbSijweT/JKV4FvWokR8y107 SNyTLuiQtip94JZb+N8MuzwjU6Z6IJdoftu+l/cev0H0n7/3Jvx4XwxHllBZj35SHXxw R+Cw== X-Forwarded-Encrypted: i=1; AHgh+Rr9g9vPPqLQchw3gX7QGMNZjXogwW70n/b8nfD06TssHtgJT+N9MLYh3aH0wb3UjGQRXLeT/Yu3L7HrU+o=@vger.kernel.org X-Gm-Message-State: AOJu0YyNY5I9FunXdpzOUieN4n2g8dMkngOhtES0PBNu9PGLISGAdsQ8 fMTl6Pkxsbhvq3dh/htKWSNNBwAQKPVyNq2GU9dH9ViKynBEEBqdpSClxzfAspvVzttGhPcYz+G vK/pnXZHx5+ea0wj87sYP8c0nNoSuEDyciApFYp+G9P9EjKD0CgNOPDkZQtjfN9aseSY= X-Gm-Gg: AfdE7ckq5ESx/sH6b5LsUSfG1DCQxMpIS1t5W12Gb3z+azByAG+v9MRhML7yMBHI/RP RsM3pQig624FOPs6+7sDsTsMHlfg1tlaL+nvtgI2wYppf4KqE30a6I3j3hLOgDBHHu8iSoxhUqX ncCDolfV7EHAglENmZDi/LVtI+zVDZqdjuR2rBChIPTGUjccecKNHJOvZANEOZE9x+9gWKhPbt9 ngUaphEtb7SQt1gyayOowCUNm9TsJ0TzIEQx4o8dDcsocQb0gKOPEEOV9ON7wW1kImnKX36hTmm 63Pu0ae+LvUe8/H8M4h8zIHFV17K2ZNn5j9ULoT32dJNUmT92v/YrZezIeOZkXwLqhUNUPdtgNu EDmQfJiRc8Z4QvXssUF9PNkJfTkQgktBeum1d/rZTEiFEu+yK5yzlekZVj0psEBNJpHi1EjB95W P34NRj9dt9s2HtjMlgCZRr2bewcVIY2WkEXjjoSJ6sGEkqkzToU8g= X-Received: by 2002:ac8:5e49:0:b0:51c:7b11:419c with SMTP id d75a77b69052e-5213f36e3bemr143373021cf.73.1784559230487; Mon, 20 Jul 2026 07:53:50 -0700 (PDT) X-Received: by 2002:ac8:5e49:0:b0:51c:7b11:419c with SMTP id d75a77b69052e-5213f36e3bemr143366741cf.73.1784559221716; Mon, 20 Jul 2026 07:53:41 -0700 (PDT) Received: from QCOM-eG0v1AUPpu.na.qualcomm.com ([2a01:e0a:830:450:751c:d61c:c91:60dd]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-69e7000c3e2sm4800215a12.30.2026.07.20.07.53.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2026 07:53:40 -0700 (PDT) From: Loic Poulain Date: Mon, 20 Jul 2026 16:53:33 +0200 Subject: [PATCH v4 4/4] phy: qcom: snps-femto-v2: Fix possible NULL-deref on early runtime suspend Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260720-qcom-usb-phy-fix-null-v4-4-4d2a0f06d53a@oss.qualcomm.com> References: <20260720-qcom-usb-phy-fix-null-v4-0-4d2a0f06d53a@oss.qualcomm.com> In-Reply-To: <20260720-qcom-usb-phy-fix-null-v4-0-4d2a0f06d53a@oss.qualcomm.com> To: Vinod Koul , Neil Armstrong , Dmitry Baryshkov , Wesley Cheng Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Dmitry Baryshkov , Konrad Dybcio , Abel Vesa , Loic Poulain X-Mailer: b4 0.14.2 X-Proofpoint-ORIG-GUID: Z-FV2B13qQIhKPew0LWtJOWbrFeI__3f X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIwMDE2NSBTYWx0ZWRfX7sv5+a+w221p KltP8JxoJKuxzBmQIPcNq0c7iI7XS8lpHdfrmrtoDY+D2cZ91ivlvN0f66fAHKGv7sgoZbjCwYE 0S8QjGElzYb9H/kutWlRsPavVl7DEGvRo9cKfOM7Za1fz9UgUh/t88arbXpmvyv4ZGol7fm24f0 yLnpD7TDQQUXkeFsEyjgrxWro/Gc7f9aQ3GUVMrc1ktOYJdtX8MDSxi/j/jEOZi8iSrzNut9dM0 OqJN1yh94gFwfoYHtbwrzjnSQ42K0c9j1Nfi7wt4YyCmenSwYmkyVvpiH57Q9XK/uaJFnd2kuuX If9UCZPuDvHrRXzY5cY3BN3xRkPGOozEDdmekZNKR5RBRAWEIOKfM165Y8I/bz7tZBDYECWc4x4 Zlt1MLe4qkvNZ6Uz+PxCdZevWdivHD3OY8qei/aL6xI431qSi4Epp+UpYVmuJP1MJ1pU6ciz5mk 98ge2JHbeEdm9p7q9mQ== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIwMDE2NSBTYWx0ZWRfXwccJXMdIegQ0 WyqSnrw+VElu+FPqhalUl4Ea4TTUulUJ7gvmf1QQhIUf+wn8YUq7T7xcSWr5PF1zpNUpCxTB+gd YToK4wWEeUcq7liifh/s5W2aatd3VPk= X-Proofpoint-GUID: Z-FV2B13qQIhKPew0LWtJOWbrFeI__3f X-Authority-Analysis: v=2.4 cv=bv58wkai c=1 sm=1 tr=0 ts=6a5e367f cx=c_pps a=JbAStetqSzwMeJznSMzCyw==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=EUspDBNiAAAA:8 a=PcYcMbZi39MCwOMHHM8A:9 a=QEXdDO2ut3YA:10 a=uxP6HrT_eTzRwkO_Te1X:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-20_03,2026-07-20_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 priorityscore=1501 spamscore=0 malwarescore=0 phishscore=0 lowpriorityscore=0 clxscore=1015 suspectscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607200165 Runtime PM must be enabled before creating the PHY, since phy_create() only enables runtime PM on the PHY device if it is already enabled on this parent device. However, the runtime PM callbacks dereference the hsphy instance, which is not yet ready, leaving a window where a suspend callback may trigger a NULL pointer dereference. Take a runtime PM usage reference with pm_runtime_get_noresume() before enabling runtime PM and release it once the PHY has been created, so that no runtime suspend can run before the PHY is ready. This also prevents a short window where an unnecessary runtime suspend can occur. Use the devres-managed version to ensure PM runtime is symmetrically disabled during driver removal for proper cleanup. Fixes: 0d75f508a9d5 ("phy: qcom-snps: Add runtime suspend and resume handle= rs") Reviewed-by: Dmitry Baryshkov Reviewed-by: Konrad Dybcio Reviewed-by: Abel Vesa Signed-off-by: Loic Poulain --- drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c b/drivers/phy/qu= alcomm/phy-qcom-snps-femto-v2.c index eb0b0f61d98e03963bf92e5c822334f52636abe7..b1a85518fed0a7a35516d16da3e= bf69afe760e40 100644 --- a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c +++ b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c @@ -599,8 +599,18 @@ static int qcom_snps_hsphy_probe(struct platform_devic= e *pdev) return dev_err_probe(dev, ret, "failed to get regulator supplies\n"); =20 + /* + * Enable runtime PM before creating the PHY, phy_create() only enables + * it on the PHY device if already enabled on the parent. Hold a usage + * reference so callbacks cannot run before the PHY is ready. + */ + pm_runtime_get_noresume(dev); pm_runtime_set_active(dev); - pm_runtime_enable(dev); + ret =3D devm_pm_runtime_enable(dev); + if (ret) { + pm_runtime_put_noidle(dev); + return ret; + } /* * Prevent runtime pm from being ON by default. Users can enable * it using power/control in sysfs. @@ -611,6 +621,7 @@ static int qcom_snps_hsphy_probe(struct platform_device= *pdev) if (IS_ERR(generic_phy)) { ret =3D PTR_ERR(generic_phy); dev_err(dev, "failed to create phy, %d\n", ret); + pm_runtime_put_noidle(dev); return ret; } hsphy->phy =3D generic_phy; @@ -622,8 +633,8 @@ static int qcom_snps_hsphy_probe(struct platform_device= *pdev) phy_provider =3D devm_of_phy_provider_register(dev, of_phy_simple_xlate); if (!IS_ERR(phy_provider)) dev_dbg(dev, "Registered Qcom-SNPS HS phy\n"); - else - pm_runtime_disable(dev); + + pm_runtime_put(dev); =20 return PTR_ERR_OR_ZERO(phy_provider); } --=20 2.34.1