From nobody Sat Jul 25 00:56:33 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 28371342173 for ; Tue, 21 Jul 2026 13:05:58 +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=1784639159; cv=none; b=ibKWG4svFjYduHpZLgNL764WLGQVnej5MT6A+FAzjXDDKaMU2RFDCFgphKxISp/yoQBERyUGLPXH7XyWguz7oEmVQThclUsR1JZ6qf03MYEpdmxYbqBLRWFTlPvK09o8IQcyfhgFYTnd8TIu+P0i+58bBDDw3OFUrcD78Qaiaas= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784639159; c=relaxed/simple; bh=0fg/0n8jqlk1rTqLof5aMrLhYmwz4Lkt27r4G+FR9W8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=T9HquWhuBynNRmyas1iNabeCc4o3HVYx/1OOUFvlS1AbRKWZlD7vo6tyjG9lg/RxFMA4vWZ7OkLJE+d6YIVVtpgtC4yquMgnIkW+uk6xNtZl6z3KZPewWUCBdeVhxB6HOWy7kXL4n2B92advpNVR6ScB1jmrOklG89OEIxobtxo= 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=PCmwzvjZ; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=izzdLit2; 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="PCmwzvjZ"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="izzdLit2" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66LAR8GP1134525 for ; Tue, 21 Jul 2026 13:05:57 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=PCmwzvjZJsGmSwHV GJjJJjGLkb4McjKi/J5CJfZeEjpDCBucAKtPx5c0yL87LUVSXFz2wggQNV6c6pw5 xYVrWJPengSkHx0T29xVbWbyXDvMNB/kypXUrb1AFQb71ptRfXMuc5ow0DEF53MA bKvK9J1BOqjAuVZa96oNvQPCa9nokb1xretPhtDQxeupRqEGlbks1mcDsUApfU8f BC+CmXtH/1k8Hqj30RBN7QIbKU8AJMqlaVgbVNHbxfGpF210U9aSGKcaMYmpCe08 RiDCSD1lGqnDYFfEU7uOsXHFpKAi1gZ1JjUPe7Y2TeEoaDuaGgTToIQo6ADwwQOM 4lUXiA== Received: from mail-vs1-f69.google.com (mail-vs1-f69.google.com [209.85.217.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fj0as2v22-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 21 Jul 2026 13:05:57 +0000 (GMT) Received: by mail-vs1-f69.google.com with SMTP id ada2fe7eead31-744c204396cso8602845137.2 for ; Tue, 21 Jul 2026 06:05:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784639152; x=1785243952; 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=izzdLit2G//Zqy2bg1kqyfKX04meCEbqWm6APqTGhWLj3PeKUfiD/pPm7/QYEzSTos Y6PjR9XQ17adadwbdawoxWtRS448O1Z/qwbNZS+iIBZqOl3mno4JdthMTakMuAJ5TmkJ EGdoeH93vHSEb5SuMLvYEhQBO/urzK1AputhfNtR2moEDDtQmKLflWB39lpNArosXhIg V5bvctn9VqeOEuSjz7fnV4JU1+p0VSIaVpF19jozN7gMD4i3GLTygYegV9lbZGujkyLj 3YiSD1jaaMO0digocB/sluNMIlcYFhJc8oopv6FotGGEikb6WN8xmwitN8nEtiYbxd4Y 7GPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784639152; x=1785243952; 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=Lero87DASHlgODzzsUWcF0PXEA++5d2a5xGT2OgFvxGFeJWfxdFbGk/Xgjw2IltzGn X4rniqkTb/tO9vOcnvqGhTykFnB0yEC7MYScrK8Nj1593WbdLeIUKhFPtAWHqldmMfLt vztCMVmwOxNy+BfnLej+0+p5n4fYJUm1lImwMsDKkPqx/YLACrHae0V5+Z+ZnI8sXi5B LU5pFB5kl9P4jyE+frjuknch0FWf4Zna3gLAZMAr1ZSS7L7CBYfa4XrHWpIC+c12ga2V 45cpy0MJXscV7I9WtbGFferTAJrDBuPcLEFSZwLMPuzRolLCbISlmKhjzwhI6zfTXL5c LPrA== X-Forwarded-Encrypted: i=1; AHgh+Rr1uCoSPQ+rOLEudt4wkhQYTcNBVuCvjoBRZ2aoH3Vv4GCwbxWzVf/xfacqQWuHnorh1ghzV5L9lo68R/0=@vger.kernel.org X-Gm-Message-State: AOJu0Yy3UbJR0nKSP8CtGdMW6zX/qV5lVncblE9vzDtKibY0/d/wQNM+ wderiiihXAW8mDbG1wJZDh4R9FF5+kufIBwesGS2fUj8DLWYzcuIr+8pHevM59y0Gd8xzEHy2M8 ugz25fGla07//0IoER/86Gl2NUOXSFsCNTVu/iJdb0m743Q7QhjkAs653tTvbRg6IUSw= X-Gm-Gg: AR+sD10DeL1RsmUrUKhAl0u/HZtLnFMyIkMkjMeh7NbHVx61SIsJnATm7KXvQ8EBBww zit/hEL/Nch6jToopfccHFZESEf4KQYuKIqUcR6JbPsb8+NX5zxI3tom0//orNPoxz10tlontee cW0tPPCsdiAZdRtDllOqaYEt/zENF3sEThdv0acrTZeVQ5dYg8+uzM5JFRhA0PcmRs7beoMiqhP naPY/PbGzbH/9hhkuExVehOYbT3/H/XJnRDb8WkTcBpE8o55EQvlsZmU9dHOIjLiAQwrVDL7+hk 4Ipnv1484+TW4k05waUhJcnMegZFwCMxroAIj6VHcrBes1xRXWSwSATEa1QkxRpEd9lCWxaQKnQ eZaWrD7Gwt0QQ0yrbEUF2uLyRVsFif4rtfYs2S3hmq7jV5m2UziGEa1IQsdmwvgTHXu5UcZeFlY U/fOd/0112TLDpPOVSmLzdCcZdxjb7wnAKOdqK1ieGj/C/KaQYpVQ= X-Received: by 2002:a05:6102:3f13:b0:745:6b08:c338 with SMTP id ada2fe7eead31-747534ca994mr7023313137.10.1784639151585; Tue, 21 Jul 2026 06:05:51 -0700 (PDT) X-Received: by 2002:a05:6102:3f13:b0:745:6b08:c338 with SMTP id ada2fe7eead31-747534ca994mr7023246137.10.1784639150566; Tue, 21 Jul 2026 06:05:50 -0700 (PDT) Received: from QCOM-eG0v1AUPpu.na.qualcomm.com ([2a01:e0a:830:450:751c:d61c:c91:60dd]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c17009ae04bsm591898066b.8.2026.07.21.06.05.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2026 06:05:49 -0700 (PDT) From: Loic Poulain Date: Tue, 21 Jul 2026 15:05:45 +0200 Subject: [PATCH v5 1/5] 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: <20260721-qcom-usb-phy-fix-null-v5-1-a181e2adbd2d@oss.qualcomm.com> References: <20260721-qcom-usb-phy-fix-null-v5-0-a181e2adbd2d@oss.qualcomm.com> In-Reply-To: <20260721-qcom-usb-phy-fix-null-v5-0-a181e2adbd2d@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-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIxMDEzOCBTYWx0ZWRfX0U89SifXi2Yd rRA3zxVxkyMonmPOsKrYtOofj4dXacFgalEzd8JGHfjVURvLdqaAnGL74TZyTCthtLplQBNoegJ N1YK89hcgftgRtnhWzoONPuB3AQ2B6weN/Hzg8ls5+NU2L2Vx5I7elqQniclAN2OXvdKnJJd+aQ BQCcXGZOBwBEo3vR457qgGhfHTniLjt65RjUqq2EQmbbRiuwoghwEAr16vlhR6nIsmMFQB5ImQi nkhaNDcVXtbIU9u+9XtekeOFECbS2ZZHQVkuMXA9XwICosU1behcuMgjvnNZ4v4PLmKgi0Y4MPv ix4mNA8OV+lYaIicvqP4lrYPjNZmYrp6l5ULHaz0Hs7SGgNpCwZfjmQuEfDn+eth6dRal10UFiL GZ8nvdh7vGy4taslW8GECtHOcOWKXIfZGDOGwHZNXrD3/DC6zMJ4K+9dQnuF464fgYLLD7U3/ds TqyjOcdyytLKi6rrj/w== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIxMDEzOCBTYWx0ZWRfX1Q0TCuV6W1b4 R0cUShCVaQ6Dfq8YYy0/FCv/oMH/zMO+32MW/Zr6IFDL3/h5+AXJA8+FzdQPNRmjDi0awB1aWAM 56S7WzmzJ3vHj8Zhxs3Way79eu7rtpY= X-Authority-Analysis: v=2.4 cv=DoFmPm/+ c=1 sm=1 tr=0 ts=6a5f6eb5 cx=c_pps a=5HAIKLe1ejAbszaTRHs9Ug==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=PcYcMbZi39MCwOMHHM8A:9 a=QEXdDO2ut3YA:10 a=gYDTvv6II1OnSo0itH1n:22 X-Proofpoint-GUID: qiny07-Ef6gQwKoxbC_gs6KaoTFwv3gh X-Proofpoint-ORIG-GUID: qiny07-Ef6gQwKoxbC_gs6KaoTFwv3gh 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-21_01,2026-07-20_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 phishscore=0 suspectscore=0 impostorscore=0 bulkscore=0 priorityscore=1501 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607210138 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 00:56:33 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 435FA341057 for ; Tue, 21 Jul 2026 13:05:54 +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=1784639155; cv=none; b=UDi+OEbBwQyHJZ9BmyWldziqhJcqx5/wkSfhf1jzoe/UszSncQGSEbxAWeIeFVkrlnf8EyTmNRCvrXrSaxZmgdrBKK3O08ftIPHvXVJxzCVm/QiW6ZBvj/sxOpBsGg549rqJulYn+0WikTzrz7K6HjodjDXGWkK5Bp03LjDS//s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784639155; c=relaxed/simple; bh=Gv4mdxekx2e8aCObHel7a/UqUQPMN/Dl1/vyDPxgxi0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=a25JNS+H9xSa20wEFdin0KbAnRoZYRGs+qzZ7rdcb+R2qHG3qDKJAJWiFhfRoJB2ZHV5p1wpLjrVSHnkjFM6aWzevqJRb7La53ZC9DWivgWuMFUalyYhcBWzMGABPuUSIcO2K7s6VR9GanGS5b/f6EoXn/rIgbAb+LuXXwex6UA= 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=l1XXiear; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=LvQoehqu; 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="l1XXiear"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="LvQoehqu" 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 66LAR2rN2502820 for ; Tue, 21 Jul 2026 13:05:53 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= ArevCzpRzOB06CCKd2tNeB4LMRjUeXNscgEPzgFVN68=; b=l1XXiear32KiBO9v W5xcP4duKlk8YwkOsrlPlAoxk+q7W+pb0WPtYMA7fUhbuAZDJqsD78JRbotZff8C 8PFmT9i8WJncUA1YqWNnGWhI416GtsYShPYE1nz/E4GT4sG7+MJoL/OOj/waQ9Hj 49nqarxfQgvozVnY6JmYesqp86NhpUcychte8HxlwNAQYSiBLGEf/bMIn0OhX6Js FMfBLKlWFeXs2qCVtsc3y6ebLtuq+X7/TbrsmbIgl1cGLJFSl7EVW5gn/N/f9vNR gY+fYYEwrQhW0BrEb0UUCR2wP5OOzFR5IfsWRH0WAOPwUx+6b2HR/o3OpVIWsPE+ 9o9brg== Received: from mail-ua1-f69.google.com (mail-ua1-f69.google.com [209.85.222.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fj6nsrvb7-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 21 Jul 2026 13:05:53 +0000 (GMT) Received: by mail-ua1-f69.google.com with SMTP id a1e0cc1a2514c-976feb78d1fso4293660241.2 for ; Tue, 21 Jul 2026 06:05:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784639152; x=1785243952; 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=ArevCzpRzOB06CCKd2tNeB4LMRjUeXNscgEPzgFVN68=; b=LvQoehquktRzss6GUaqNeDJIZRXMS1KwSnfIOsK5Lj4M/xQBk2gqeRNoCuDBov16aI 6u4WrEVg8U2t7xzxrxIUpE/3U+y72daSYWXUsTqGUqnb6oaeFYZbNGCbvc9DBvJBz53u TtqwwiuuYxgkh30dtnPs4x7RvlFQkNS4dtrAaj4tiTPlK1AIbBHbme+gk0wBnGhiPuDq 9KuWOzl9vLB0rhhVdZswLzoPV39ofmeBAO+Zuvk5HovKtMBgjTMMh7NodBwuGrlDGDhc V+KcceRzUkpL/ptURhWvQDUGTkBnYxNb9zmOVkxuebk2TQRNde5OzyTWKRfIhSqMMGFg zDaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784639152; x=1785243952; 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=ArevCzpRzOB06CCKd2tNeB4LMRjUeXNscgEPzgFVN68=; b=Hb70d0BxIKQD5vCCuCo1tbpxl4+DK2CiT3aTZaV/krVjPKqUeBgcBc/BfDv07fbLzN rgPPiDidCadoEO1VOiPzKxk/95bsVhjrhOhf+yRcK+vZZ4bMRHRhhOjAjEQW9L00GLrF J33AgsFX6LDowfhS+at2S+tdAdzGrbxM6z1G9YPBt++4tExdtTFic8PBDT8vvYkDFsrn zcGFY8Bq0aTTbn/JglfFEMpqf+aK8JjpXepWEjF7ldkxR7CbhErpqwgM7hygkgxfg0MW 9/+p8+Y02TMeoW5n5u5NcZ0bxYUB4D+dhVOFMgARXzXhsMDER62GNEpglS+4B8o/Dneq Blpg== X-Forwarded-Encrypted: i=1; AHgh+RqFg1fJJZhO2K3RYlgVmQYkJmJR3wSGiWBSYpJ54xdAQMdbRfqPki/l6ZkVSs9Hqh0n5iiUpS3cIgvAAf0=@vger.kernel.org X-Gm-Message-State: AOJu0YwBZwFictJNekDQVJVtZ/PDLzGd5tK8gPPzG+bJOvTGrm4x9opw WSryQsQSjbPtfUl9jI3vGOkc4E4r0s4jfnfvRmbnRiSv5Tl1o8gaeTmFXm8Z/zTWFxKjZmmTI0c bSmlhl2eUQvRpN2Lm1QSrphdxWUv1vJrTh061KmjYbIg51tuU2O7m8YlWvC7b1246Pr4= X-Gm-Gg: AR+sD11La5wVqD4EW0tJP0g+vc/rL3PQd2zrSmtRfJXibtcDtqhspwMdnEWWR5qgaVN JrlaK7LqsRNBDe8DOStSFUhfgYR8F6V3POAo2tX0DGHmJuwJcVwUPTTZNhuQQZvE7dD4q1ozmkm FGkmyRY5eMpv6nQeVzreLMaKU0itK9FXXrByxCePIPpSdXeLKdyfp+QLc+pRB96W5slgUtcloGt 2S7ZmU9PYaDYJ0587YreFLq/8xb7ZKrxeEVg6R0YLpnqMZGHvBEDHH/L8nWwc4AUasYpiUYDbtU EW0Y+RkTw7SOfTReCj5q3Syrf9dUbM0YVvIWvAIGcKDEfj3o/ixJwTccnxgVjZDzmvo6dw3lCHy izWypzq+wNhyyt4RasLD8VWt7Wto7370l4zhLtCRoI0+a3BAO6h0QC3hZ6ou12yrjT+F0w8D3Xw P+UWfmC9hrg9bkfjYuT6gr6MjQZKF7QEY/fPlqZK2umtweYlNUOhg= X-Received: by 2002:a05:6102:1487:b0:729:affa:70fd with SMTP id ada2fe7eead31-747534bf4b0mr5780651137.8.1784639152416; Tue, 21 Jul 2026 06:05:52 -0700 (PDT) X-Received: by 2002:a05:6102:1487:b0:729:affa:70fd with SMTP id ada2fe7eead31-747534bf4b0mr5780628137.8.1784639151990; Tue, 21 Jul 2026 06:05:51 -0700 (PDT) Received: from QCOM-eG0v1AUPpu.na.qualcomm.com ([2a01:e0a:830:450:751c:d61c:c91:60dd]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c17009ae04bsm591898066b.8.2026.07.21.06.05.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2026 06:05:51 -0700 (PDT) From: Loic Poulain Date: Tue, 21 Jul 2026 15:05:46 +0200 Subject: [PATCH v5 2/5] 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: <20260721-qcom-usb-phy-fix-null-v5-2-a181e2adbd2d@oss.qualcomm.com> References: <20260721-qcom-usb-phy-fix-null-v5-0-a181e2adbd2d@oss.qualcomm.com> In-Reply-To: <20260721-qcom-usb-phy-fix-null-v5-0-a181e2adbd2d@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, Konrad Dybcio , Abel Vesa , Dmitry Baryshkov , Loic Poulain X-Mailer: b4 0.14.2 X-Proofpoint-GUID: 7PUEveIVWAClc0D_jMN-RS34SvuyDgYb X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIxMDEzOCBTYWx0ZWRfX3KlI0pNbxulP odHuvFI4oCftEStZEF3YkwOSNHMRcVePA8Z7LgxcZP36hjlJ1P9upi1vsci7If+nucjalivqUcQ PqbV4YsNPJtIebHb8NKGTAD9oiwn9z8= X-Authority-Analysis: v=2.4 cv=ZJjnX37b c=1 sm=1 tr=0 ts=6a5f6eb1 cx=c_pps a=UbhLPJ621ZpgOD2l3yZY1w==: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=TOPH6uDL9cOC6tEoww4z:22 X-Proofpoint-ORIG-GUID: 7PUEveIVWAClc0D_jMN-RS34SvuyDgYb X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIxMDEzOCBTYWx0ZWRfX6d6O5AImWIww hUqp3MRgEGOV3/ILjeqPD4d8xiC87OYPXd9Df7Aruj8EMimVtyMEgstd4pPpqJog03in6L8l8MQ em4ha/3oB0asTqaFmPBwlbKT02y88ITD6gvkNw6rlJYUXh8Xt1IaE3q/9lulOAjd9bz6sM12yj9 qzva15u6lpiKOwoaaI/vny93qts1DjTDHm/mmVCq9ctDzVEMvzNUwgZ4a3+12gw3agRLRFpEFzq hKM+yZZ+3+TyBm6zl6J5N19eBEi2UzzEAdyYvhfnnDtHdqXIbD8ZEga4PTpMqMVUm4ZiO79viNP dqZnSJQpvnFRu5PoIYoDOsRFwBIQTE5oA8AV8wa9uEUq4Y90i+4GD6Ba4IO8catAWw6hoyELzs8 Xga5dwBiwMMdum+PI7o02qMmzhIphOjqKWY4XVOIUWa2fVDC03dEX3/RBI4tSHTuRBDUZfu8/OS IFDxcwEnhT7zfdEQ2KQ== 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-21_01,2026-07-20_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 malwarescore=0 spamscore=0 lowpriorityscore=0 adultscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607210138 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: Konrad Dybcio Reviewed-by: Abel Vesa Reviewed-by: Dmitry Baryshkov Signed-off-by: Loic Poulain --- 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 00:56:33 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 E48832417D9 for ; Tue, 21 Jul 2026 13:05:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784639157; cv=none; b=dTjnRUB2xXtVdGiy8PHiZlqLIrzcvVJLPWeDqzb7MWOAyqIAIUAc8iN0yxVtomuyWVSGILwWc9nlPA4iP0wiRB8wXDbnDVnP0pdUQGTjQUhALzieNeaU3hjDDYZVUHcO29RluUXg/oBhFOM6oaeAHAh+HnVYOlCUbzVFAhIp0Xc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784639157; c=relaxed/simple; bh=1uCSE9pS0uK8c8rmwdqjcZn44CXrmRxmSQbFF1quomQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rrVnxq9qKrnD6N2vFOOOi+yJLhki8f2cv+ihSAA4hLcnTX2Hy/dqIazqJ9UKR0EbkyvLfuYGIYn2MLa2/f3zxFKECK35OnqXW2ydhClXieOHWTC1Xdywa38accj18HlatV/VLKxW0w0DpTygc+z2V5OVrzcJwn4zDbKf7ytdeAA= 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=GyFacerb; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=H6n7Yvfk; arc=none smtp.client-ip=205.220.180.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="GyFacerb"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="H6n7Yvfk" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66LD2vmk1616638 for ; Tue, 21 Jul 2026 13:05:54 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= w1VnrF5mL82CPISYHMNOBYhwf3W9zInAag1/ZxJRFrs=; b=GyFacerbsu+7NaWF PA6zCWDW9/Z2oximPkP3NhvZeOLrSkdd5rwtoa+SmYmnzqSSIcprdvf61lpGvqUC s8J4xAjWdLXRtom04ClRv7zoN4OPMBYFBuZl8Rcq283F4XaLfzd45q7N/rJYxQrG SgeJnSkUt0R+US+ooe1GADTDM8ugUMcZzlEfGcSSZsPLaxinmzB7snBNF3rSjx71 F/wvZCbH7wESDGTyVqKmTgyT09/4xHY114+v7kpSI+l2qZ2EXciB0hrvQw7kS4et UmAgEK/Ia0uDG+rVgt84gP+g6yqUp1rzsTwvv1oSsnOCokrALq8ehWwAQbyCMAuf xqVdiA== 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 4fj9ae80jf-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 21 Jul 2026 13:05:54 +0000 (GMT) Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-52769fc3f2eso2905571cf.0 for ; Tue, 21 Jul 2026 06:05:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784639154; x=1785243954; 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=w1VnrF5mL82CPISYHMNOBYhwf3W9zInAag1/ZxJRFrs=; b=H6n7YvfkNHsviUmL0Ww9uAUVeb3c+M0zPpDDzIfOZvV0R6WAL8sd8pGDBd/xjSxxUa aiOVFTnzVhpDocbASMRsBT8qjs8KRHiMhfm9UoKPp2bX8yoy+V2Vd0WrJoXAaYdecqYz BiOFSvs5oIH/fLYwrE0lIGfpnU6EBFgcOdXp1p5Xt6xnKDGQC29fNzk8MT3RB2A2NT1R 49vPRiV4Invsaso7Rtd5KFOeEW2s9ivZAjLIBxVqHdXKw7XVyFmYvWaPJnDSnQAlUxhy 16CFMsQ1baonA+9EiSgo+PuwX9O4sM9B8COw3y6hqNB4O+FAUm91Etmaj/BpxmwwEj5B vwVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784639154; x=1785243954; 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=w1VnrF5mL82CPISYHMNOBYhwf3W9zInAag1/ZxJRFrs=; b=YUDDmg0R83dRWuFKZB6F53kL9jwy/+SjWuqzMuH7MBEwAR8PG1sYlzNIbk4cLUhUj/ jbnrC0qgDWtc3G8qUpmzb38busMLtgXMrMd3pX3uBnlRTuNOaxsgNQ8k7YrhCRFDC8SG RK7bKZ3ot23SzJBJdLuM138FvNUK08kSfGXHWFav9TwTSKu8m5t1s1TyIFVWeDuMqpyw iXH3Cy//LO2UzbGjhpK4xBoJ0E+pd3cnH7z+lDsd/a4+8q5FLHmVVZOx23FmHmDL3AOz 6FbyTaQeSh2syIE5Y1yPQgAQnqiLB1IKZhwYfukdX3Mqv7xt3AC014wdkRQQE0INH0IZ ioyQ== X-Forwarded-Encrypted: i=1; AHgh+Rp+/EjXNUUTxVilatfKkQ9NHRhFbqsgrEalRZlKZ/ugLdUvqS0ZtlPpW6Gg6MD8uk9aGpFk3h6KkHMkt+Y=@vger.kernel.org X-Gm-Message-State: AOJu0Yz4GH6kUOOYs6ldJgy8JOSe34jdpuZ3p9EWw3yZL9zAYz91jJ5m jcjpg6LLfrKBHMTDgzyGxZJpns7oYWFoocvOJs8PgAbg+/v82j2Bm+s6DmahwpKsYrCmTDhh5YT HFClvcB6eexm68Gb1b0f5CFrBIGlGUggVvho5+cBmK5swgaISPrU2asRlFdONsZQcicI= X-Gm-Gg: AfdE7cmdwYp3yGwhR0i/D9OL6cSJKWkbbsTGWLDSEHHjuCsrGf+3x8iW4PzQHfyN0b5 zaKlgDNu16avx/JqtBUDHFFXCzK3V+5igCrxJi7fnKD1VZ1NEKDu3GimnggMXJKnssTbTP9x3TG OTQx3zB8T1ES7mD5DMAsCQ9DPLclhN00VnrD+0yfmSnyE3Maog8ndXTEtuh/p2WPvDgys0eaT3S ftsKY6UCADhBpm88llFVoLACziKs6v+WzmXKAn/YcoDITf17eKy/eKgQlbYeM+zPcZfdVbdYqtl mbRxO3BEzHL/2D7bOtGKPJ83K3LhnXc5Dm0Ha89BHQ87KA1qemel4mEPGLwscQ8oskt0yzyYsdW PTJrFM87NBgf2ITGxcphnrxB6/qtpGpgbbDJgqkOJHt8ANnLwHr805exejHrjLyCFJhAxuP+V3F 2fk17sCjvQoOFDQJViBzv46D+Hx+lcaDaQwUlln9qcH5LU1MWlCgo= X-Received: by 2002:a05:622a:110c:b0:51c:167d:b346 with SMTP id d75a77b69052e-5213c5f3a9emr164338281cf.23.1784639154098; Tue, 21 Jul 2026 06:05:54 -0700 (PDT) X-Received: by 2002:a05:622a:110c:b0:51c:167d:b346 with SMTP id d75a77b69052e-5213c5f3a9emr164337661cf.23.1784639153460; Tue, 21 Jul 2026 06:05:53 -0700 (PDT) Received: from QCOM-eG0v1AUPpu.na.qualcomm.com ([2a01:e0a:830:450:751c:d61c:c91:60dd]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c17009ae04bsm591898066b.8.2026.07.21.06.05.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2026 06:05:52 -0700 (PDT) From: Loic Poulain Date: Tue, 21 Jul 2026 15:05:47 +0200 Subject: [PATCH v5 3/5] 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: <20260721-qcom-usb-phy-fix-null-v5-3-a181e2adbd2d@oss.qualcomm.com> References: <20260721-qcom-usb-phy-fix-null-v5-0-a181e2adbd2d@oss.qualcomm.com> In-Reply-To: <20260721-qcom-usb-phy-fix-null-v5-0-a181e2adbd2d@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 , Dmitry Baryshkov , Loic Poulain X-Mailer: b4 0.14.2 X-Proofpoint-ORIG-GUID: kGMMfp3xUUnMiAQuKjL5UMJ-RIxyzOWf X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIxMDEzOCBTYWx0ZWRfX2K3FmEgHxTTt F26GiabnSBQYKaqsuFHrhCxZjtcg+22zZ7Xd8KdgUQHY94pqVjk7GvinMHgHh2ZwfxjJaMZShVT b5w/N1Bvx1b3zWzZzgXccmMSjV3u7n4= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIxMDEzOCBTYWx0ZWRfX/ByaxcOHZm69 MIiHpqi3m7wd5vTdF4NPfBzwON/4boz+9jqprnjWAqeFxwJJZ9TrSQrai6A2gIbV75ZASADwixL o9Xm9gOV05tqFgV+66Myac4U3l7ci9Kn+fbJP2LdF2+SdGRe80m6jl6qzlx97i0nGNmMJa9I32d z3f+/+j/xfPSG77mQTh51eLgVhWaZYPHoliTPoXvvFt7IMey+i/b3diX5tfbSqSMbV7SzE5RqAl tqyhUqxFvwgUghZBvb5BhnaNztzu2RmtHLnmF+BgsIHCheQbd3dgVZhPefTn9nF1qyjjqf5ehe/ ZPmgcTW+gufMm+/5y7kSfxM5fhOyu8WTEY94GUy2gN958bGBKJ9EVnFFed7lN5Ygv3G8J6Yna8a Bs0ieyjEXCvZA5ZxX3wb4klurXhO4AwMzkqX67tYA0vFNCeLoFhDg6F+2RhLbCGoR+jxVmwvB+B xue0PNSbIpmoJqgN3Rg== X-Proofpoint-GUID: kGMMfp3xUUnMiAQuKjL5UMJ-RIxyzOWf X-Authority-Analysis: v=2.4 cv=Cr6PtH4D c=1 sm=1 tr=0 ts=6a5f6eb2 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=yx91gb_oNiZeI1HMLzn7:22 a=EUspDBNiAAAA:8 a=QCvEx_dtP_Vb2dzgXhUA:9 a=QEXdDO2ut3YA:10 a=kacYvNCVWA4VmyqE58fU: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-21_01,2026-07-20_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 adultscore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 phishscore=0 clxscore=1015 suspectscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607210138 There is a small window where the runtime suspend callback may run after pm_runtime_enable() and before pm_runtime_forbid(). In this case, a crash occurs because runtime suspend/resume dereferences qmp->phy pointer, which is not yet initialized: `if (!qmp->phy->init_count) {` This can also happen if user re-enables runtime-pm via the sysfs attribute before qmp phy is initialized. Similarly to other qcom phy drivers, introduce a qmp->phy_initialized variable that can be used to avoid relying on the possibly uninitialized phy pointer. Fixes: e464a3180a43 ("phy: qcom-qmp-usb: split off the legacy USB+dp_com su= pport") Reviewed-by: Abel Vesa Reviewed-by: Dmitry Baryshkov Signed-off-by: Loic Poulain --- drivers/phy/qualcomm/phy-qcom-qmp-usb-legacy.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 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..fc490589c8e4888770807a60170= 905a1c7610421 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb-legacy.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb-legacy.c @@ -542,6 +542,8 @@ struct qmp_usb { =20 enum phy_mode mode; =20 + bool phy_initialized; + struct phy *phy; =20 struct clk_fixed_rate pipe_clk_fixed; @@ -895,6 +897,7 @@ static int qmp_usb_legacy_power_off(struct phy *phy) =20 static int qmp_usb_legacy_enable(struct phy *phy) { + struct qmp_usb *qmp =3D phy_get_drvdata(phy); int ret; =20 ret =3D qmp_usb_legacy_init(phy); @@ -904,14 +907,19 @@ static int qmp_usb_legacy_enable(struct phy *phy) ret =3D qmp_usb_legacy_power_on(phy); if (ret) qmp_usb_legacy_exit(phy); + else + qmp->phy_initialized =3D true; =20 return ret; } =20 static int qmp_usb_legacy_disable(struct phy *phy) { + struct qmp_usb *qmp =3D phy_get_drvdata(phy); int ret; =20 + qmp->phy_initialized =3D false; + ret =3D qmp_usb_legacy_power_off(phy); if (ret) return ret; @@ -988,7 +996,7 @@ static int __maybe_unused qmp_usb_legacy_runtime_suspen= d(struct device *dev) =20 dev_vdbg(dev, "Suspending QMP phy, mode:%d\n", qmp->mode); =20 - if (!qmp->phy->init_count) { + if (!qmp->phy_initialized) { dev_vdbg(dev, "PHY not initialized, bailing out\n"); return 0; } @@ -1009,7 +1017,7 @@ static int __maybe_unused qmp_usb_legacy_runtime_resu= me(struct device *dev) =20 dev_vdbg(dev, "Resuming QMP phy, mode:%d\n", qmp->mode); =20 - if (!qmp->phy->init_count) { + if (!qmp->phy_initialized) { dev_vdbg(dev, "PHY not initialized, bailing out\n"); return 0; } --=20 2.34.1 From nobody Sat Jul 25 00:56:33 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 CCC46342515 for ; Tue, 21 Jul 2026 13:05:59 +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=1784639161; cv=none; b=CJaMqp/BE9Wk5BNGGjtaqQrmn1rZ/8MhbyGhiSOVbxQpnCQzVEMYJPOmUeyxHUakhKsmd1dbio5vVzqJ39pf4HHJP3LYZoSXE+/CoWVx9YgQQXFFl+UzWssnjZ5ZkEHbznRsVAUskmEGvfTZYOODOosJyOoiWbgEj7mQ5erTm9g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784639161; c=relaxed/simple; bh=mvZuz4R68MDpMBJuL25COqTuukLaTsnYTOOzX6VHfJU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KvG/7IPL+DTKD0RyC8xM7SVyGm9FnWfdOyJvMKovlyTBy9WcwAx1g2q21Da8YpKIUDgx4/CjHZTrooiLK15Dbgodcyw37SCJBU0I8gdbtBWPt2mCA6Vv73QMwRijpyavS74L9zoJCzx3RnCDnr0gRLZhfWabKGPxUseUhmOrEAU= 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=ZTjFUZZA; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=g4J9wgdo; 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="ZTjFUZZA"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="g4J9wgdo" 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 66LAQqPV1611735 for ; Tue, 21 Jul 2026 13:05:59 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= +31G3iNyhTEkeua3PfRYEfavCmIUVylJgJKWF0Z+7JU=; b=ZTjFUZZA0SBpYMNR HFOBjb8j4jgjl38hdsS+/YUwxVvgoYksr3E4Q1QHd5TUuhIeEEaCt8u/HI28bJzp kDVKZfbRmzkQdGSdX6+xKtibdVgenuNfWGW720Ewsfkgv86KH6STmPVPe5Zr7RR8 lno5SWG6Nb8wGZoHFWrVjGIAmyKDkgIM3R8ozYifxgW/JeNHo2kTPRnHeXoHNDsj NtKXc9hPiLgJEHs61RFXeF9bBvDMNQxz6CR5jpp7etYUUM7FmtkerN+q5h6S/G58 b06fbuoKFmjqpAUQVIKoZ3g12CXi9YzewDw2/H4wPojZJLdME6a/ZfaVpQIJgvEs Xqxf7Q== Received: from mail-vs1-f71.google.com (mail-vs1-f71.google.com [209.85.217.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fj6r3gtrm-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 21 Jul 2026 13:05:59 +0000 (GMT) Received: by mail-vs1-f71.google.com with SMTP id ada2fe7eead31-74ab80df960so1027178137.0 for ; Tue, 21 Jul 2026 06:05:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784639158; x=1785243958; 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=+31G3iNyhTEkeua3PfRYEfavCmIUVylJgJKWF0Z+7JU=; b=g4J9wgdoekp1lsNWz3Jvw3gIt360O/yBEAR3AXiiIy7ujDbFRsLpgsgSGMHSFcdMUd sm/haJUa0kGyFJzdExvfO4Ygm06jec0DPVhDL0CHl4bPRTfELzRVkQfCSLMKKDM6Q7mj DKQmnuFsjwEuVJR8ev7LoGjXUa9/FEC9OJt5xvHv+fRQke8IodVFIMzb6I1rDn4hmi2u 3z0CAwoQuch6sfMKHAXYk/0gWhNrB0NF0xFHJvK2ftVqaVg/4c3p8Wsv5O2BvWb8wBoH 55e+HcNFVnm6XQW/MgtBUVmc3XiUAElS/wuwbOfZiI6C/pTXscQHR2xpCMkDVFsL5IdQ pncg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784639158; x=1785243958; 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=+31G3iNyhTEkeua3PfRYEfavCmIUVylJgJKWF0Z+7JU=; b=QIbOKzU/E5kr/j5WRGhw3ecfkJhxY+7DpDVe+2tc0LU/OQJl+OMylPzQ8Sfy9GkNpl cvKkVL2J/wnRg2mkCXmUcADID28TO618knkln9hJZ2eKCYZVWAPWF9bknGplcbHBYfDQ pJ8CAeut5y0AyxIf7c4k5kIPrWwK1rtRPLvFTtX+0lICTJrktP6GrZ85ABDTldTRrD1w o2y12e44LLnmuFj22Qfbhy1GmP+3jUqjntdp2v3woKhIj9shEkB1QVe5TqziFAbkrS83 fCvt06JmqD9WGvH7fy63peGHMxOl45UOiK/QSvitHaUdiX0Bmeium7+v6xf6N2dFph72 ZNWw== X-Forwarded-Encrypted: i=1; AHgh+RoMVbakvPQTwfV/MGCmpdElY8TCwAAiHzYJutI1pHa3+AmKp7+4j5UohCSHsr+ZLF7n63hPYJNawXjFAys=@vger.kernel.org X-Gm-Message-State: AOJu0YwpEbCsruyhi6Av1nLhUa+uFxSeoqQ9Pi9MBLR8G4YAMFyL1A3L kSZLGxdIy7Dthbjn3fQZdO5k7XdWvyPRZG/bLx4XycpRJcOUYA3VPRYkBZxOc/AUbn8tsh4maR3 J+8LI6iNVRFt/ljXKlmjUI4n8YorZBb8L06FdRJyFzMWRA1BzhWoq9BPVOhB8RmJq2eM= X-Gm-Gg: AR+sD117ObT8vUQd3JSG0msLUAgQ41SkCsYg5F3q6hhEV/G21TJQTGOrQvRaKtSUuew dIxIsFounej0dXoXyE+Oqq+HQZCeQHXon+cSkLMHKJafhLQDLx3A+SyGAMIkSCzg8gcUqLpPy9f U1j0CZQWkWOokLAkF94iWD7F+M0nbDKjG4vekNM1wjl6AgAVqblcy6FTIvi5pvL5LsSBvMxnE+R d+B/I72KuzNFj15CD5sAtMzyqkqobshMqo/MsMQlTCh9m1+kMOYLWCLjQ0Ssoy0FuDir0xzsp+v lXiu/ZkOHNhsxW5gUWm/nk+b8rX6MogSEsdSMmvNITMMwNn5aytKwKndHw6W/306EbjfQVfzVnJ NzTiFk86GrctobKxnpxeZxTUdN38fDLRCxisVXyfeHOMoCSrOclPRq3jXZnpHamTrymzGRqQVeg lfrsnhAPAmZ9LEfWuyUovHZh5FAxfQFOA1Y2rnSnRtshRPIiJhoto= X-Received: by 2002:a05:6102:1612:b0:6e7:5c89:3fc0 with SMTP id ada2fe7eead31-7475374957emr6867629137.25.1784639158004; Tue, 21 Jul 2026 06:05:58 -0700 (PDT) X-Received: by 2002:a05:6102:1612:b0:6e7:5c89:3fc0 with SMTP id ada2fe7eead31-7475374957emr6867500137.25.1784639155104; Tue, 21 Jul 2026 06:05:55 -0700 (PDT) Received: from QCOM-eG0v1AUPpu.na.qualcomm.com ([2a01:e0a:830:450:751c:d61c:c91:60dd]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c17009ae04bsm591898066b.8.2026.07.21.06.05.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2026 06:05:54 -0700 (PDT) From: Loic Poulain Date: Tue, 21 Jul 2026 15:05:48 +0200 Subject: [PATCH v5 4/5] phy: qcom: qmp-usb-legacy: 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: <20260721-qcom-usb-phy-fix-null-v5-4-a181e2adbd2d@oss.qualcomm.com> References: <20260721-qcom-usb-phy-fix-null-v5-0-a181e2adbd2d@oss.qualcomm.com> In-Reply-To: <20260721-qcom-usb-phy-fix-null-v5-0-a181e2adbd2d@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 , Dmitry Baryshkov , Loic Poulain X-Mailer: b4 0.14.2 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIxMDEzOCBTYWx0ZWRfXwvO35qxR1cZD hD8O5p/NvVDnMfl20YUFjCAG04DtxjhTBaSvsnRoj8slCzpGg/gYsUyuQ7AAMo3uJ4pJ0fjLx61 S6i91hseCMESjmIvQYsDw2Rg3kGoeGLXHpjkxkMSE1Ceh7KpR4bFcn07fYZuwpErCsBFstoSbSO 9G4AZAD0VAMqP20lt3aaoL2eijwKC5buTthYqzIXqPJFNf6zcIZHcFMXJ026w2gDQ35yW4H8LxJ KSv/QFTA9zcVbQA59SQCGrpF8d5W2/L/m1RrGIZkxoQEAOXjw2hNL0WaoYbjWV0+9wstBnSLuEq 7qHYPdLsMVu26Sf9Zx7cxXpeOHHZE8uU8MZzTfiCGh4uObxZC0D/xXXGdNrkoRoKvvFKN52b+PF smMfARrubzsrg3LwZH+ItzWs4iOawjV96MwUgjsdqoUFNOGaIDrS9d6N9ESP+ZcFALBfNOFSo/d kzNeIw/O4bJ4ThSvWZA== X-Proofpoint-ORIG-GUID: Hsblk__WNSwIgilExhnIRlpIDckhzVQZ X-Proofpoint-GUID: Hsblk__WNSwIgilExhnIRlpIDckhzVQZ X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIxMDEzOCBTYWx0ZWRfXwgZWFzvUIPQl dR08wRbOvSxyrC2TXgsbqyU8Al8VaiWcAZvoUHK4HPhiOLMPK5gkzl2fNXVWAKvBaHBgQnQFe8u UTHOicsM4bVWj8hofc86CRmMQMeY8ek= X-Authority-Analysis: v=2.4 cv=SIRykuvH c=1 sm=1 tr=0 ts=6a5f6eb7 cx=c_pps a=P2rfLEam3zuxRRdjJWA2cw==: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=ODZdjJIeia2B_SHc_B0f: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-21_01,2026-07-20_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 spamscore=0 phishscore=0 clxscore=1015 suspectscore=0 adultscore=0 impostorscore=0 lowpriorityscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607210138 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. 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 PHY is not yet registered. Take a runtime PM usage reference with pm_runtime_get_noresume() before enabling runtime PM and release it once the PHY has been created to prevent the device from being runtime suspended during that window. Reviewed-by: Abel Vesa Reviewed-by: Dmitry Baryshkov 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 fc490589c8e4888770807a60170905a1c7610421..eb1826fb26f0868f7758245b0cb= e1a0590fea9a3 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb-legacy.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb-legacy.c @@ -1285,10 +1285,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. @@ -1297,23 +1303,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 00:56:33 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 80757346777 for ; Tue, 21 Jul 2026 13:06:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784639163; cv=none; b=RaYPJ0mz2dEVU6g5iOkW8pMqvNIiYo5xU1we3cddAy0frT6XE2Iih737AP8pLJ1j0bNBdFPBHyA7+cL4RkLRUzkBxBreal6f/4GJV3BRw2cwFqlyOjQWgO3iwzKp+uKF0ItTyCoCvuok9ydGMp0dX2Yq8aOymSP7LZtOyF8LhOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784639163; c=relaxed/simple; bh=hB43yDM5wPsZ0p8kCzuf9vWRzlFYjXS4Z9sUYHruMMM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=T0n23PZN1DCOdPeyl3QIJhXsgZJnYa6zPJgXivxQhnWO0r/6x6IdA7/VGGLfJNdlcXqndwts4sgbTV8DuMHFiIJiBUZlLB0IIFeDwEmhpci6djAq3TAZ3ooAxKA3djzcjEwuKpLKTCMTBOpduB6YMhgVsKT0CGfsze0L1ViZPIY= 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=jszkDaJf; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=gJWB2nwc; arc=none smtp.client-ip=205.220.180.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="jszkDaJf"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="gJWB2nwc" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66LARNWe1499957 for ; Tue, 21 Jul 2026 13:06:00 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=jszkDaJfDaNZQX+G vLXRqKgoclNXEm8JrFbRzkROKZXEQidCi9/1RwolO0KKUQkBaGclbwDlblIWNqak MaM1ZGHU0VwexiDod8Afoiej3LvJF05gVb1eFryupAGqiX8eTA5VVjuJid/Rcohq gKWQ9WVzanQwbgCBBdsRs0Wuy9W91PwB7C0VRcqRztDPOaGp+WE8J2U+AzB7q0Yg f/4L81f9i14u5/ZCm3qfEJxGKzALx2TXm1RyZwa+gNidzGbLwqnAQGDiakfA09QN yEpljJyTLfxCmadIYz++1Goex0vwPimuhxUq3v+VI2IlqLX0YTdtkzkkNw/10LvX dfiF8Q== Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fj1bvtfk7-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 21 Jul 2026 13:06:00 +0000 (GMT) Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-5174a23afcbso98748021cf.3 for ; Tue, 21 Jul 2026 06:06:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784639160; x=1785243960; 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=gJWB2nwcRkm4jCoKabS0dtSS+l8iKmZoQaqwS91/pXsyQZBgRdZiVxhc6iQdbw4Q3w liG21BTzvnXKEfDqrKo8wY8Tw351HQMa8GocEr5oy9pUOGlQrcBGXSxZUuBgPO9gt+Y8 h0yrIZ3eIp5g/RA2MiZODaXUnRkj2XQDdu0c0Xpfn0Oi4XyjmKW3Q12nGXf+OULYqmZt uebKRBBLQIFi/LTBN+unmQCdTB5dGqmokBqiEASoWbXpTp7w6B2H0E+7kwDSqQWxl4U2 BtsFXLp7VUFIINnbGsiEG/fS8wwikHHJ8twvE+iu0usZxV+uKQ8/qVZ2QqJRY7ITzR9B EPsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784639160; x=1785243960; 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=QEzBWt7+llwlQxSZ/OftXYoTTa/HpDmXbC2dI0XZvFf+KV6mcOqP1qbLc+sv+X88Xf cqO9SmBmwAx8qWq2hqUzxKtVnEqdewDAUiZFwjdS9of41/AUH2mVMnQoZGUeUov1pYw7 xjaP8Pf5rSoAC5cQFHjhnTE+f0NYXMgomvgLbElujJm9q4mEcf/f12WwTlGdAjrMHFoE ny8ZIvyKYtZHMbnp4isC7/6te2/WPhqSDCyzd2IjogmTdevFUdXPR87R2dsy7gL4HW4v bTrLit+Tm1V9dj2q684ccDIDiWVypDQMfY15BMofQMyBX4jBDBdN61n4OcHqYt/EAPVh 2Uhg== X-Forwarded-Encrypted: i=1; AHgh+RqlF3rP5sZhwFGUjYbNgMygmHHzUDnVOk8cbMuqj4yCiK5UgpvdOVdQXs8ILKmajnbR43uhEDGPne1Z+xA=@vger.kernel.org X-Gm-Message-State: AOJu0Yz2iEVlXr7o6rMGkKRZazuvzuUAdOP+JVJ6RCYlLQrSvdCQjnQr SWoeDcMRrqPSJ13sxG7tdZ3GTFbx40DZ8BrBQ4kbV3B5SkkLb3UAKjYnAw8Y5TsMWwzrSU1cM6I TFwTW2rImrzBoQ4ZLXyzvvQQfgHF8LrylfRmbGewzCX0ptLMPR2xE9mPKNPXPwb9s0S8= X-Gm-Gg: AfdE7cmobFFbgYQCmfzFgQibBfJBfeMK9ByzjBwBbawMEdHHqcWh+tnrLBZeGUQnwpj IYRqVaW+h/rndFS361efQ9/mQaBbsC8sUlm3egqUlEg+AEEdELtPsuDbf995Jfc7AY2saPLchBd nHnArEjNW2bAUxjZp8W5qO81zYyc5qbB8HVyP/QvwROnGENf6Ll0anL87mrd54y2Fr0pmZanzJ5 8nH3Re/qa6oocLz8meReAfUkWr1aZv6UITQ4Coog+WK04juNgLX1fNNvaCTMrp7pV6DSVqShCw+ U7Pdl7uJ8u4usS+5GB3VJ6T4/OZSika3J2o+zNgHd26rzTCy8pqZ3gWdDSgDXjrHzZzbb5X4RkO 8hDgSuLAyxSNb4bsm11Gme804A1VqRPuDkI/uqli8FeouPP76Kvl9kZOhau1JdlCK26JQgS8rWk JgIIHpEh/mXPb2/fvnSdVb/LEBXuzodAGb5WZM7qQqarrhenHQk40= X-Received: by 2002:a05:622a:228a:b0:517:5e32:af1e with SMTP id d75a77b69052e-5213c10a757mr161124541cf.8.1784639159684; Tue, 21 Jul 2026 06:05:59 -0700 (PDT) X-Received: by 2002:a05:622a:228a:b0:517:5e32:af1e with SMTP id d75a77b69052e-5213c10a757mr161123831cf.8.1784639159021; Tue, 21 Jul 2026 06:05:59 -0700 (PDT) Received: from QCOM-eG0v1AUPpu.na.qualcomm.com ([2a01:e0a:830:450:751c:d61c:c91:60dd]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c17009ae04bsm591898066b.8.2026.07.21.06.05.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2026 06:05:58 -0700 (PDT) From: Loic Poulain Date: Tue, 21 Jul 2026 15:05:49 +0200 Subject: [PATCH v5 5/5] 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: <20260721-qcom-usb-phy-fix-null-v5-5-a181e2adbd2d@oss.qualcomm.com> References: <20260721-qcom-usb-phy-fix-null-v5-0-a181e2adbd2d@oss.qualcomm.com> In-Reply-To: <20260721-qcom-usb-phy-fix-null-v5-0-a181e2adbd2d@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: e0ROcgFaHiBwoebTfv-b3p3oDoDc7gXX X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIxMDEzOCBTYWx0ZWRfXxjlSQeXwSZG+ 39cJMssV/ijtqq/WfAqM7IsHGQ4mZb8QF81OiHgoBFH/xVNxSBNxmn86uz26PcMKAX2JJfiy0Wy jqkQTpuaeT9KOSSuLkNaPaHEBKG2++U= X-Proofpoint-GUID: e0ROcgFaHiBwoebTfv-b3p3oDoDc7gXX X-Authority-Analysis: v=2.4 cv=Sb7HsPRu c=1 sm=1 tr=0 ts=6a5f6eb8 cx=c_pps a=EVbN6Ke/fEF3bsl7X48z0g==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8 a=PcYcMbZi39MCwOMHHM8A:9 a=QEXdDO2ut3YA:10 a=a_PwQJl-kcHnX1M80qC6:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIxMDEzOCBTYWx0ZWRfX81XAk+kitYGj 1lf4igg2bGzAbMCFmRKFqqIlHLvLjMnErt3aKQnrms7XCMpkZe7a/bUiTkWfWE/nKuN46UxHhFJ uWrNbqGc4e1baC4IIl+fzNHXnxtxz/6OKhw1w1PHWUHLVM+FJKZb1IQPUIuvJA+5e9Xez7e9rXS quM6icGDhNn07i6vo1eFnbqMLaKVNw+QG9umO3/6VVxCDQ39bnHXYTHbs0Mcu1j2Abo+34dKhCe LFIyGqCTwCNAAcf5/9WACP8+EtMBdV5gu5t6PUJnWgwujjAyeYE53175/nBfmb/sWwFoi2CXgrX 72EAxfEh2xI05vrfx5fSL0C/1QzxH/RX5xDZTJhd84Sqb6sMUNMSm29YA2ndQA8Y86RUL8g3Ecc B7jMGsSnmirLtfIf/39ehG5tBKlAjFxjdwHwKReAGK/wqrj5pMKpCGKhtp8+DQfhsTdrCeUPAtJ w9tgjx4fAlxx3cxUQ5Q== 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-21_01,2026-07-20_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 malwarescore=0 spamscore=0 suspectscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 phishscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607210138 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