From nobody Sat Jul 25 22:32:26 2026 Received: from mail-wm2-f0.google.com (mail-wm2-f0.google.com [74.125.225.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 147D634388A for ; Sun, 12 Jul 2026 17:55:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.128 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783878942; cv=none; b=q36DNQxkdZpgVAbcRQvuhk2tKjUNE3Vg+LJLckNRnB+hxrzhKcS218fSHm4hVjdG61k5wIlF6iHF6PEZFc7kZwVRPjlB5oI8iqEAp79AAjR7b1z1UmNic9qdbNoIGUl+s1IxezXRA8HP+UaJVi3+Gnlgo3nOuS95LZ45118cPLQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783878942; c=relaxed/simple; bh=RgZg+NcjKlFBkqbvlYHtvyMRvFEwM8G5G0XCnD835vw=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=DbR/5ivcpL9ewjKlVYZkdWD+NvpzxeKUa4Gkw3RYqPVE8Rn30RUs3Oob621sWzg9pNsYwLCsBet4o6JSfRCz7PC/jYZoRulDWKDXbSVDbHFp0fD62BF6QZskptn0Y0hrwb0vL7ht0isKvOBNlkQYRXDE0WNVHpWMEiK/oxzI9c8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SbeGXB+N; arc=none smtp.client-ip=74.125.225.128 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SbeGXB+N" Received: by mail-wm2-f0.google.com with SMTP id 5b1f17b1804b1-493b4d3a635so6207915e9.0 for ; Sun, 12 Jul 2026 10:55:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783878939; x=1784483739; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=0E37CKL1qGtMYOAXyCjsl6PdtLnZ6H9NtG5TxTyJ8tM=; b=SbeGXB+NjdncMZubtVGJecIQjD7/1ZJQDXWAzWfTzfgZqzFjixGzQyXFJWXA7O32XE Xka38BCDdyp5mdYKCL9jOGj9m3NUjXm82fyWKMTbOAzePLObFUes2nXO2zi05XktYfgF xtuIVqu4nqT5Z/1TTAHKLB+hKcM6XMuDycEIWMyBO5eVgS/nuLs9VWWyBPTDYFkw5h2H yJYS5iEzvV/1AAXozwzi5hOW1xmMh19NXElythFS+NxEUc4z5gFJXJOxY5cXk7ajlb/8 pylrnBrdDG3NO+OYy390oOPJnB0+ADUrSyTUoh30zAMXcXu22gt8ykmQarCzeb9eUVGo rQng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783878939; x=1784483739; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=0E37CKL1qGtMYOAXyCjsl6PdtLnZ6H9NtG5TxTyJ8tM=; b=CEjZJ410lt92eWDkLH1KJ9rmax/A/On3OibbN24BafoidytMsYJof+AeQnTMFVaxmA 7IKGhCqWWUGa+FBaC/qQ0XR+H2uph5pSU+WPfTB6PaequnCpdiJ84eZWugnRXxOJvfwE fA6x39TG+RDJ1g7+MtFp0I7BIzkD5e8Fa33qF5tKRm/JyQjOWr3iqWpxDuh8w6S2qhkF YXMrgs5G7c9qloz51AlOHTCK6Oq/iXkcd9R8vdTHMBiShhoABtpydKSMcQjGqvVHncJa F7Z1tDsbxnj4z27rOkjzsh0IKf81ZBAPoJi1ZziwzrmszKDGHIRl7AH1BIbJK7QxukbC xj1g== X-Forwarded-Encrypted: i=1; AHgh+RoGrN4lmA00EHRAhjqCo+vfY4X9yXAip41uSdCH0hNa1Qr7qsfLoVNsaOXazXXSsGsMqvckEztXlo4Pj6g=@vger.kernel.org X-Gm-Message-State: AOJu0YxbTWxVjFQVYdPXjEJTbouuLMnqZ2oQMFtyEp31zWODYWIWUUiL hC4HggdcsNwerT2FD5J2RVe8Q8BkaRa9JnvMVTPp3Z/Jt6vM2YTnL7T/ X-Gm-Gg: AfdE7cnJKAaM3Dkrk3oBOUsnPAnGleY+LUMRfHXVyQkO9i0zndxJ/5N7WppOvZ+eoeb vX1xvBDq70iSuzBDsjs0Bue3HKWO4c3aySS+lk8R4S0Dnu0qqiv92gYVlUgnkaRXPPGRmeUwj1+ Z+JfQVp3GozQlKNQN14aVG1Vs/cJlTkOO3wR5Qd5j5KiuCcFl52t6LCMm7WGF9OECRyiSSoA2rl XMdhdMc+9HMPYmzcCCI4zCDCaP2bD6JvDr/0ZSCeKcdyNDyt96iTd4ElZMestI5Hzy6ge+MmQCM IE6RnSvE/lm+kZhPX17MN2EUyCKQQ5lyWvFTpZGUIQqLddvI714BesWCxU0SDLB0Qe5cPXLYMov /Yxb5RzBF1XRfxW+YnyiH3BfVndnfSX4Ap+mzO3Ghl0X7S4L6reETfQRd2k3dTIYCfW7JKGjY0/ XB+2tb2TmTnBNnNegAZHc= X-Received: by 2002:a05:6000:1ac9:b0:478:77c1:787c with SMTP id ffacd0b85a97d-47f2dd0d98bmr6806058f8f.56.1783878939166; Sun, 12 Jul 2026 10:55:39 -0700 (PDT) Received: from workstation.. ([202.163.123.30]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f273195d9sm19562091f8f.3.2026.07.12.10.55.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jul 2026 10:55:38 -0700 (PDT) From: Ali Tariq To: Kevin Xie Cc: Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Ali Tariq Subject: [PATCH] PCI: starfive: Fix unchecked pm_runtime_get_sync() in probe Date: Sun, 12 Jul 2026 22:54:27 +0500 Message-Id: <20260712175427.232234-1-alitariq45892@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" pm_runtime_get_sync() is called in starfive_pcie_probe() without checking its return value. If runtime resume fails, the driver proceeds to configure PCIe hardware through regmap_update_bits(), enable clocks and resets, and power on the PHY, even though the device may not actually be powered. pm_runtime_get_sync() also increments the usage counter even when resume fails, which would leave the counter unbalanced if this error path were later handled without additional cleanup. Switch to pm_runtime_resume_and_get(), which balances the usage counter internally on failure, and bail out of probe before any hardware is touched if resume does not succeed. Tested on StarFive VisionFive 2 v1.2A board. Signed-off-by: Ali Tariq --- drivers/pci/controller/plda/pcie-starfive.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/plda/pcie-starfive.c b/drivers/pci/cont= roller/plda/pcie-starfive.c index 298036c3e7f9..e9a472985b8a 100644 --- a/drivers/pci/controller/plda/pcie-starfive.c +++ b/drivers/pci/controller/plda/pcie-starfive.c @@ -410,7 +410,11 @@ static int starfive_pcie_probe(struct platform_device = *pdev) return ret; =20 pm_runtime_enable(&pdev->dev); - pm_runtime_get_sync(&pdev->dev); + ret =3D pm_runtime_resume_and_get(&pdev->dev); + if (ret < 0) { + pm_runtime_disable(&pdev->dev); + return dev_err_probe(dev, ret, "failed to resume device\n"); + } =20 plda->host_ops =3D &sf_host_ops; plda->num_events =3D PLDA_MAX_EVENT_NUM; --=20 2.34.1