From nobody Sun Jul 26 01:11: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 9AFA23EF0D3 for ; Fri, 10 Jul 2026 10:13:10 +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=1783678392; cv=none; b=szrEpnx7KFU7Ew2FSaseuqmu2NMIXb61MLkGIMidRjzquHZUeMF/AdW+hZRH3v/EUPjTcKw/32XVexOA9+B3T+MqzCy4MtsXScEWP/EHdsPKjHaFOfjobxht0mR4WrV/pbJcu5Q9r6beeeYz3Ld8z+hVpXEmQv6/NmOUMFFK0eA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783678392; c=relaxed/simple; bh=fp61jno8++niFT6E61fh+qdDmseCUv/upWK5jKW9rF4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=px9E8yTWutSDqVo7AifeeN03Cb+9VeNqtrJjXs5d/zYA1RxwumTntykXn9cHxacVY2yDN1Wv3n0gtabycG8IleFXD85NOM9zBzMIra5C2QxuThad7svD4v82Md8C1SseiOyp8lS+0Ks19jPv46fV5+Ijf/9INEFqjOSTioGYY0s= 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=PvQhTW5/; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=J3H7cvl9; 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="PvQhTW5/"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="J3H7cvl9" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66A9ThJd391398 for ; Fri, 10 Jul 2026 10:13:09 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= SzbP8oJYA7lcUAvmgkMoQ6cRClvc0YKd16KRtgIXt4M=; b=PvQhTW5/4hhjrrgA 97x8FdCr98oqEst1fYU3R2AzLlMri3EztcmjXQEmfP9rIXZSoCXJAEmMmmNk0BaK GgrLTOjooFFW2+YRRaQi8NENS0KwqtQ28HQQa6yGLRzQiOokZ74boC0nvUECFYXF W8v9oOkFArWQT2Z2HztJzl2p5NbYiL5RyKxKH+lJ0RdV1SBbD/QOKwqGl65T0Kls 1Krp2A1+TqCq6MjYZWqU8ZryHFjAxK5RBGuvybVwiffXhnyH0QB9cLC+LgJxkVfB DPYWn9V+gh2Ri1TRSKhYY92rjGr/tfN70eTg6NeDflXCLd87ew0m9Sc6z+lGYdtY BA/0xg== Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fax5f8587-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 10 Jul 2026 10:13:09 +0000 (GMT) Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-84854c2f888so1515525b3a.3 for ; Fri, 10 Jul 2026 03:13:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1783678388; x=1784283188; 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=SzbP8oJYA7lcUAvmgkMoQ6cRClvc0YKd16KRtgIXt4M=; b=J3H7cvl92HkhugqYBmQcNDuHwQc1kSTanpTYAfp+6x6iO/5bQV7H8w4RuZJhrAjVyw W2J2TMkauEbwo6yyWFY8YmdvERR0XKtSh0azooMYTfiL3AQfD3GN8213lWm65EddyqAp 9Qj7Xt9v1S2cAy9Y99+R2WKZSEdZ6ydvwcp5u2u4M5eeiszWDMWZKNwJiYm6AvhVxSvo LPZiNa3YCpIg41LCQ7GCvaX4XjNc9X3DATrVX4jVfXsLOw1tVBbynfN9UM6DFIWybHWw iSus6LLc5vv82SAtuvsORrKx98tJ54sE8Rq9wNJWzUd0o3uNIbzSEkyPAOZeQZ20DtAo GQXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783678388; x=1784283188; 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=SzbP8oJYA7lcUAvmgkMoQ6cRClvc0YKd16KRtgIXt4M=; b=VeabP1HukqhlAxWNsZSKvleQfJ5JPAfsDUAHjBMYNIawPSb3tAm5UXwQCFbLetZDi7 IZC4YHLRhRm26bNHnSBoH3gtJaqt2cuoVvZ0Ema8p/JCgSxQ6wHg4VwMIC+yqYnEkFVd EeA3RvdbIxH6FQGSCI6Ud/NcpRTnmwZMrwVMtwMLLyZzRrLuSZoQ1jAB/iM8uAsyx/8h FzJKaPABNMsVi0SqObp4Btpf6UNNS1BAhhjH3vjoNWrKYB4YwU0J8QwGXtdsosWwbBVA UqaxUQ9PYfp9o81nBVde42i1Reiatbst00dwPot6PcA3JP2duEfjLGb/rE/rtbjD7awn DADQ== X-Forwarded-Encrypted: i=1; AHgh+RpYhkgjU9MRL4X+gho1L8SmWBDMxYrM/P14q8xeUwpENHR96J/tzjNEsNFUZnMEP2PA1DbJpJTsiAgOiS8=@vger.kernel.org X-Gm-Message-State: AOJu0YwjN8NeJImGNLGbjGGgkHzN507Ml5T0tiLUixf6RPmG3qVT6O4K ttbW4eUVzKBIz5xg4ilgWJ++z/vSc5o3081Qfg9s6FlmnilCBWl80NElVEy9nhTqsvgRAAVsaEz I6zyX7aImuQunVw6FBYGz4fIVaAoWf9NuCUTOjtLkJGyP2OrnkPA8+YZqwnKyd0GGJVA= X-Gm-Gg: AfdE7cks5HHzKHdm9JlbDxBBhEqpMHeqNnDP+UeLqnbLKWrqH4JAMWxo3urm16C9hYz KebU09cHkDZztgMPLRgngyXtkhTb3/7OjRMXu/li76bhq6CGhfWsHMCX9xw2+NDsdYjc3n7Nm00 CdhUAyNRcznuO2euybwrtrBtvfgXMopYQMLP7uDwGjo4fPYMu4nEbvjSKnVndE1ru7KKnTAFtJx n0ag+yvSwOvTqnx3uolhvJ7pLpZ7AHuiBh2kg/1z02ZEBVUBBXOfA74NRaTRW+4GirrF1nSSrRq VNaiAPTgKD9ca7oLUg72Q1Jz1WiJI6OOLD6YgRkWWJyFnGdiiWOeurqdmOhSCe3NCUmpLaoggAl GpKMEmKd6jjjZS0bfbfBLnMWmVumsGSunsTxd2I33uRvA X-Received: by 2002:a05:6a00:288d:b0:848:804d:9c5c with SMTP id d2e1a72fcca58-848804da18bmr438266b3a.38.1783678388541; Fri, 10 Jul 2026 03:13:08 -0700 (PDT) X-Received: by 2002:a05:6a00:288d:b0:848:804d:9c5c with SMTP id d2e1a72fcca58-848804da18bmr438231b3a.38.1783678387676; Fri, 10 Jul 2026 03:13:07 -0700 (PDT) Received: from hu-ptalari-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d7a96fsm9977815b3a.46.2026.07.10.03.13.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 03:13:07 -0700 (PDT) From: Praveen Talari Date: Fri, 10 Jul 2026 15:42:43 +0530 Subject: [PATCH v4 1/2] PM: runtime: Only set runtime_error on suspend callback failures 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: <20260710-fix_sticky_-einval_after_pm_runtime_api_failure-v4-1-be81d6c15043@oss.qualcomm.com> References: <20260710-fix_sticky_-einval_after_pm_runtime_api_failure-v4-0-be81d6c15043@oss.qualcomm.com> In-Reply-To: <20260710-fix_sticky_-einval_after_pm_runtime_api_failure-v4-0-be81d6c15043@oss.qualcomm.com> To: "Rafael J. Wysocki" , Pavel Machek , Len Brown , Greg Kroah-Hartman , Danilo Krummrich , Mark Brown , Alok Chauhan , Stephen Boyd , Douglas Anderson , Dilip Kota , Girish Mahadevan , bjorn.andersson@oss.qualcomm.com, Konrad Dybcio Cc: Praveen Talari , linux-pm@vger.kernel.org, driver-core@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-spi@vger.kernel.org, Mukesh Kumar Savaliya , aniket.randive@oss.qualcomm.com, chandana.chiluveru@oss.qualcomm.com X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1783678373; l=1909; i=praveen.talari@oss.qualcomm.com; s=20251114; h=from:subject:message-id; bh=fp61jno8++niFT6E61fh+qdDmseCUv/upWK5jKW9rF4=; b=GXSYLi8r438TIXhUlxg8cHoKyYWoGVzcZUQcWC2ddFq1Wud8IbjmowbFPWlatss/e0WWZvCUa nMcPZtXkklCDp/PDbkouYtwW0n6usAERIFxGeC2QhTHh3bnb3YoVwj3 X-Developer-Key: i=praveen.talari@oss.qualcomm.com; a=ed25519; pk=NGK/88fjyHXgfhIKwag7+uIytOmyOypvZ/hDFaYPEss= X-Authority-Analysis: v=2.4 cv=Ab2B2XXG c=1 sm=1 tr=0 ts=6a50c5b5 cx=c_pps a=WW5sKcV1LcKqjgzy2JUPuA==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=TpI2hjkGOM-ZtQ_OKuoA:9 a=QEXdDO2ut3YA:10 a=OpyuDcXvxspvyRM73sMx:22 X-Proofpoint-ORIG-GUID: KlY62Vr02Thv1qDa8MUmWIGs7MDL8z8x X-Proofpoint-GUID: KlY62Vr02Thv1qDa8MUmWIGs7MDL8z8x X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEwMDA5OSBTYWx0ZWRfX6nP2MAFiLARB WWJovR9xaOg+KUKpTmIqJlJ69BtLHkJh8gIEorDHZaxBXk0mJEo+1pEZCMWwkLxGdxAZQJx87hu l3GwATiKZgwZUj51O9cyZnUUZNLy4k8= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEwMDA5OSBTYWx0ZWRfXxgsQPrCJUWCa hoU2s8hTzoLcd2C8/xpISiJAcODUdnUjDanzXhOrlmfKIx+7AhyfwuExcoAP9wa/lfnOcCTp/mq HH4A+BaU/vZDXV9bGwch7yzg40SrSGavbUUY2KaUclJsvNX8uVuSCFonVxxBwEbFSBkhH8KLKgD ggVzpScvH/W+38bePmwcrOxWVf7X/r5cZCAbB3tyRsaxiqSHMVPj3JTg4rHK9g7mRRPfiWIB0/j L/sTYi+vqReOLaxu8nqgbN67rIH4OW2FTqGWFtGZ8ldc7rlMZDyYSV2HK9yH01/kwz1+JxeiRPt HskZa7sPokgOGOiCTef4k8TXMwjy3eZ6nM4ysd6LjWEFFI4rAGpJooNyYWCAVOQt4hc/0Df7Myo U67cJZilWMN0xCAqtjt3wytrjU2Nln5PQP3zjdmTYMQd7jiUUd5kW1K7D2uq3VPPItBQ7aShjvo //DNFzqNZlFHpV+xmGQ== 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-10_02,2026-07-09_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 clxscore=1015 malwarescore=0 phishscore=0 bulkscore=0 suspectscore=0 impostorscore=0 lowpriorityscore=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-2607100099 When a runtime resume callback returns an error, rpm_callback() sets power.runtime_error on the device. This causes all subsequent calls to rpm_resume() to return -EINVAL immediately at the top of the function without invoking the callback again, making the failure permanent until runtime PM is explicitly re-initialized. Unlike suspend failures, resume failures should be retryable. If a device's resume callback fails, there is no reason to permanently block future resume attempts on that device and all of its consumers. Fix this by moving the power.runtime_error assignment out of the generic rpm_callback() and into rpm_suspend() at its fail label, where suspend callback failures are handled. Resume callback failures now return the error to the caller but leave power.runtime_error clear, allowing the next resume attempt to invoke the callback normally. Signed-off-by: Praveen Talari --- drivers/base/power/runtime.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 335288e8b5b3..fab38bc98113 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -469,9 +469,6 @@ static int rpm_callback(int (*cb)(struct device *), str= uct device *dev) if (retval =3D=3D -EACCES) retval =3D -EAGAIN; =20 - if (retval !=3D -EAGAIN && retval !=3D -EBUSY) - dev->power.runtime_error =3D retval; - return retval; } =20 @@ -751,6 +748,9 @@ static int rpm_suspend(struct device *dev, int rpmflags) dev->power.deferred_resume =3D false; wake_up_all(&dev->power.wait_queue); =20 + if (retval !=3D -EAGAIN && retval !=3D -EBUSY) + dev->power.runtime_error =3D retval; + /* * On transient errors, if the callback routine failed an autosuspend, * and if the last_busy time has been updated so that there is a new --=20 2.34.1 From nobody Sun Jul 26 01:11: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 900EE403B10 for ; Fri, 10 Jul 2026 10:13:17 +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=1783678400; cv=none; b=KH0vWlNqBJkhn+wW8Ds/ug6gOun5y/HzxbE4k6u91knucS9Xc9QCIhL6avvGiR+peIVSACZiISbvJgCOYw2SEIXqxQVToje8o9MaKHdE9vYe/dzXemN7mJgbKTx2JanZWUuPFRMW+WZ5cMOIwoHiBCsfoQdtWXTcz3sdqf58r4s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783678400; c=relaxed/simple; bh=jBBnW6WFudmvEPdq0uOwfkuZMk72McbQneZaQOFjN3g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BvtHOz58ipNXQxGSP9jYRfUVdlV5Wx/yVZOlV5qiVUt9v3by/3VYcIXIymO7DWRS6EQqeB8qlqtWb7cQSIMmudjwyg9h/KVOCdUX3/jjxf10to3eVrfVAIPhco6BiDpWw6lgrHkXGT9+0JNFyDX1L9wTnWCttlJtq7LjdE8RQ/I= 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=D7jSSXxD; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=EMzbeo/c; 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="D7jSSXxD"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="EMzbeo/c" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66A7drQ5188269 for ; Fri, 10 Jul 2026 10:13:16 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= bV8KvWCZd21k3Re7nM7YSXO7CD2b03uTu9SGUiG6fXI=; b=D7jSSXxDPyx7uc6c 4aut/MjSt5s4Mzo56LBaDDp/ojDd+7hkhupviKT2yW+Y4y5ScIXedvmacZ5cOLVu Hl1D7tmH/lXOq0BJDf2mps/LWCqQwZjf4K9dHtBamo4Piozxf0RUCBCO1n+OMSFr c6vlLOnhnRlFs0dX/yXT81oKdGcygN6KOvBICbI2oyxIeuXEDg2nMZBCgFZvqVHl bJJDZq5MYygMRpLo+5rbFcc/QAbYLEDK9Aa4eStt1q2XWBT3cxaoC6l3X9FqbfNV B9akTnIkKADUyl2TcaLz/6yYBGRw35WELJtBv4T9pRqdi84DHrmRUhw1UPPEjmqb vEOhug== Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4faeesuxqj-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 10 Jul 2026 10:13:16 +0000 (GMT) Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-84859a64079so1430314b3a.3 for ; Fri, 10 Jul 2026 03:13:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1783678395; x=1784283195; 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=bV8KvWCZd21k3Re7nM7YSXO7CD2b03uTu9SGUiG6fXI=; b=EMzbeo/cDv0BIRw1g/40EZVxgzleV0Y/zx34+jVsgj9OKH+qdjvL1qCLBc39v3vLd1 4s3ltt3IQU7886Ju5Hfy/9v8eQJt8uSwkQNGgXHMHz4pZQG3jwyanl0kxnhpXWU5pCHP CiIvYtts0NtqGo3NNPUzOB9uc4MUTaZe8EUjIleZnCMp8mq4sXyAzCGMuIUdn2EW1hZJ XkvT0BREfGyPIjLG+KVLiJyiI54Hy0/nyOMRGVdmvIxRZwc9UxGcvK2vn++koReGVMJH OVyari5WG9DkdQ8Xb75TbtnthVJSvhQfsMPudFqKKhMwz/X9Knp+xLXmAXNlGsmef6W+ i5VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783678395; x=1784283195; 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=bV8KvWCZd21k3Re7nM7YSXO7CD2b03uTu9SGUiG6fXI=; b=J0595Z2yYXSp8Re+ZqRcgVNIjN/f7ITgnEhEjinDg96x6x9uG800tVV12kPWMnjD6f kEN8tff/VXioStHeQKHuxtfEugLjXTBvVgQIVtB5+i7aDSkEOt1oW+RSeYw+PjYQM6Ue FvGhK+Cld/KPRtGst5OsTL8uXY5PbBjuoK1ZxSQkq/gri3IRrIRpNHJNTaPy2MCmsqNP R9Uk/BwxorMs8Gl/WHuTbodpbGhhe1BJ10sYCj7/p7H59/WS9OD1VlV4gKyqSy4VswWB L4vqUB9TH2aj/Gouvl26gEUIqUUoCY848kKvNRA4i4jEUPDg3pZ6LMPTt7A+mVwsegXP nX/Q== X-Forwarded-Encrypted: i=1; AHgh+RrbO4AJe+YxQ8gGcplcVpl6EuQ1yzMq5nD8qn1W5yCvUcHt1+xxzKExH7doriAX31TlXM3WSlH7qH61H9A=@vger.kernel.org X-Gm-Message-State: AOJu0YzZM8O0XcYP2Qg7C9cCzfrt19qP5U2I5GqcLWmUt3V7woStlR9y plAOuhlFJ9nEi8cv+7xP31nNhBgs1HvliNskAm2Cj2WAthSo+uPHIrFlWolBpPVIelImCM8K5uB dT/Z0tNFNGa4MMRmZZHAG71lbbX+D4lfGHY3qxKgJmzOl6PyXGObBd62BdNU87nzVsA0= X-Gm-Gg: AfdE7ckkCjp3WDhORJz1fzSEjUHsKl4A6tdIBU9HowEVVmKNkMEPdHMAPIoT9np1bAT PbBAX218edxP4M3vGhQh0KjQ1hX9/vk2BVSdE8fktatyjAyDQ/wYnsuALCodu6Z7wWBYVxzda/Z c5HZZGgXCpw8Y0SHI7cXSCDRoCXiJxJUJ8Tw1PM5zZgbNe/7d917fzW1wOmDIrj0Usgw1tusMc5 wYoGOxCrK0o1/ZUm+ZfnlQWZmJ0jTknuWbur88qjgFT4z+5DkGgzVsukw8XhQQlRCM7taLW0oPr EH/bnaa6XjdHCkOCN0jnOW/kYWIF5MesCU75m11UayJDGLXPuKqqXGE/Gv6e54qzSOW4zbP2LdD VPyFVKuz1J1SFBnb/Gc0Oavx00u83eAETm4UlFV0wwuCR X-Received: by 2002:a05:6a00:748d:b0:848:4754:28ea with SMTP id d2e1a72fcca58-84847542ddcmr8408565b3a.12.1783678395438; Fri, 10 Jul 2026 03:13:15 -0700 (PDT) X-Received: by 2002:a05:6a00:748d:b0:848:4754:28ea with SMTP id d2e1a72fcca58-84847542ddcmr8408533b3a.12.1783678394806; Fri, 10 Jul 2026 03:13:14 -0700 (PDT) Received: from hu-ptalari-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d7a96fsm9977815b3a.46.2026.07.10.03.13.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 03:13:14 -0700 (PDT) From: Praveen Talari Date: Fri, 10 Jul 2026 15:42:44 +0530 Subject: [PATCH v4 2/2] spi: qcom-geni: Fix missing error check on pm_runtime_get_sync() 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: <20260710-fix_sticky_-einval_after_pm_runtime_api_failure-v4-2-be81d6c15043@oss.qualcomm.com> References: <20260710-fix_sticky_-einval_after_pm_runtime_api_failure-v4-0-be81d6c15043@oss.qualcomm.com> In-Reply-To: <20260710-fix_sticky_-einval_after_pm_runtime_api_failure-v4-0-be81d6c15043@oss.qualcomm.com> To: "Rafael J. Wysocki" , Pavel Machek , Len Brown , Greg Kroah-Hartman , Danilo Krummrich , Mark Brown , Alok Chauhan , Stephen Boyd , Douglas Anderson , Dilip Kota , Girish Mahadevan , bjorn.andersson@oss.qualcomm.com, Konrad Dybcio Cc: Praveen Talari , linux-pm@vger.kernel.org, driver-core@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-spi@vger.kernel.org, Mukesh Kumar Savaliya , aniket.randive@oss.qualcomm.com, chandana.chiluveru@oss.qualcomm.com X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1783678373; l=2859; i=praveen.talari@oss.qualcomm.com; s=20251114; h=from:subject:message-id; bh=jBBnW6WFudmvEPdq0uOwfkuZMk72McbQneZaQOFjN3g=; b=SSyJjUgoguSeWg251n1KeZRyWrsQz325hAFIge4pglnHKXOmA/4WhEFet02HX4KH0aFHdds4U EjWuQGXvQiMA9czhxSLubFt5mAGm9HlMXmX3P8zySnpjyq3aMfxrwsM X-Developer-Key: i=praveen.talari@oss.qualcomm.com; a=ed25519; pk=NGK/88fjyHXgfhIKwag7+uIytOmyOypvZ/hDFaYPEss= X-Proofpoint-GUID: 1VFggei55MsASNq1U9Puk5PBFc-GSGHo X-Authority-Analysis: v=2.4 cv=bbpbluPB c=1 sm=1 tr=0 ts=6a50c5bc cx=c_pps a=mDZGXZTwRPZaeRUbqKGCBw==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=rPJgdety-6tgKaoqdU0A:9 a=QEXdDO2ut3YA:10 a=zc0IvFSfCIW2DFIPzwfm:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEwMDA5OSBTYWx0ZWRfX8HjF41S/3Wr2 E0dICtLvDBTXaqeXw+UJJ8orbmI6qaqf5nCmWApDWs9pM8Ds0cr83lcJgXO7y5/ZFxHGbgUu2Tk N562J3w26FNUT7dbPYGf33AX8lTFBiY= X-Proofpoint-ORIG-GUID: 1VFggei55MsASNq1U9Puk5PBFc-GSGHo X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEwMDA5OSBTYWx0ZWRfX/QJU5lgBNUBP pzqpRxnSc4KWrb0umxWyekUhN5KzsbvuGZ7ShqVA6FyL2+rb9lNdXh4vLVpPRSYY7tbOfRwqUG+ dENrqMOVsEci0hC/+MU9S57I29JgbsQJFQaGEbfrjm6j3NWlcevxOzNbDyZB2YhhEZDVwSoXRAr YIclI8wFL8owS5Ns3xaFWbO7SqvNBm1xWLAN3Q0DEz9GRQpTm3k1GyZjkKHem9jgeK5QIk6lifW l/xva2LuQQp78LRqm46ChzUIuUGoFyxMN6OrUzkhLSr31IOWb2XHQv1xOcOjX5Vp4AV16QdFkyk +GEjMQVWKn5xZP1+XkmIf0AS33xAPxQHyDDUjJSLr4qHmx35jehsHDshSIm8v/ECbgYJQOfTBDR qtQmiuptKF3B+eTLz2CsG3z7cEAjZWYg8KV+Zw+2YiSJDZ4BWImfayo0D9qud9bgC837WE2xanz cTX1EVNLvWKBVEKFRsQ== 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-10_02,2026-07-09_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 malwarescore=0 bulkscore=0 suspectscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607100099 spi_geni_init() calls pm_runtime_get_sync() to power up the device before accessing hardware registers, but never checks the return value. If the runtime resume fails, the function silently proceeds to read and write hardware registers on a device that may not be powered up, leading to register access faults. Fix this by replacing pm_runtime_get_sync() with the PM_RUNTIME_ACQUIRE_IF_ENABLED() macro and checking the result via PM_RUNTIME_ACQUIRE_ERR(), propagating any error back to the caller immediately before any hardware access occurs. Since the macro handles its own cleanup on failure, the out_pm label and the corresponding pm_runtime_put() call are no longer needed. Replace all goto out_pm paths with direct return ret statements and remove the label entirely. Fixes: 561de45f72bd ("spi: spi-geni-qcom: Add SPI driver support for GENI b= ased QUP") Reviewed-by: Rafael J. Wysocki (Intel) Reviewed-by: Konrad Dybcio Signed-off-by: Praveen Talari --- drivers/spi/spi-geni-qcom.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c index 88ac0833351c..2914d781dbf5 100644 --- a/drivers/spi/spi-geni-qcom.c +++ b/drivers/spi/spi-geni-qcom.c @@ -622,25 +622,30 @@ static int spi_geni_init(struct spi_geni_master *mas) u32 spi_tx_cfg, fifo_disable; int ret =3D -ENXIO; =20 - pm_runtime_get_sync(mas->dev); + PM_RUNTIME_ACQUIRE_IF_ENABLED(mas->dev, pm); + ret =3D PM_RUNTIME_ACQUIRE_ERR(&pm); + if (ret < 0) { + dev_err(mas->dev, "Failed to resume and get %d\n", ret); + return ret; + } =20 proto =3D geni_se_read_proto(se); =20 if (spi->target) { if (proto !=3D GENI_SE_SPI_SLAVE) { dev_err(mas->dev, "Invalid proto %d\n", proto); - goto out_pm; + return ret; } spi_slv_setup(mas); } else if (proto =3D=3D GENI_SE_INVALID_PROTO) { ret =3D geni_load_se_firmware(se, GENI_SE_SPI); if (ret) { dev_err(mas->dev, "spi master firmware load failed ret: %d\n", ret); - goto out_pm; + return ret; } } else if (proto !=3D GENI_SE_SPI) { dev_err(mas->dev, "Invalid proto %d\n", proto); - goto out_pm; + return ret; } mas->tx_fifo_depth =3D geni_se_get_tx_fifo_depth(se); =20 @@ -673,7 +678,7 @@ static int spi_geni_init(struct spi_geni_master *mas) dev_dbg(mas->dev, "Using GPI DMA mode for SPI\n"); break; } else if (ret =3D=3D -EPROBE_DEFER) { - goto out_pm; + return ret; } /* * in case of failure to get gpi dma channel, we can still do the @@ -702,8 +707,6 @@ static int spi_geni_init(struct spi_geni_master *mas) writel(spi_tx_cfg, se->base + SE_SPI_TRANS_CFG); } =20 -out_pm: - pm_runtime_put(mas->dev); return ret; } =20 --=20 2.34.1