From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384007; b=3WUf8nZ9lX5OCkIVO+h7JBj4hhGEImaLxjMbfL/Ii+AqUQppxDJdbIcTcPqf6gcUpGVx vK9PU7FdCso+ZFTV6Z5jgWcStP24TExhXMtr0wiRvfnO3Thg1NrwAdRjHdCwjNnFR7KCP KoKu2D5NWEeHvHvMacBqiSbvQstwtcN6lUGkQ6EHxtu5Iln6yafFT9ie8mWSWiOHhqz6Q hNj2+2+ESEgN+fh1rRQkxu+iFtTf/GtWtVVNsuXxcw3EjZ1hJlhYHf44hQFSnASBJJQJ1 uMlgbBOpcqHXHZehrtWHpyaAAnKRbn1KxYidTm5K8Pbuca4av4j1srclHcf4wi6DKAw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384007; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=uWn2l/bliH2vbyGZfri2TWWDM8JFfxA7jqDOWhF00Pw=; b=VKSJBPF4yT7GYSQRsA6nXp6muJqeAeWkBhliLHyw1b7xDQRokY98XBu7hKSIdtO0WTIE WZyjdrUzawb4nV4kUQaKwnqkUq6Bmh7tIOdNWxIhJsSSTErS3XgAtOzIdvO1r/kHu3OIq SDf5+s2ojGg+slk9QLGpao2etm3GxIsRg1nOjhpU77LpSL9y/O/HIwZ9YPZUThE0qtC2y rCq+Bz/mKLDUEIAIjYoz6Gu3gfpbxrTyFeNqb/CTZXjIgEewdZE2DzlbfHXJS/32H1PB1 5VLpxJwPlaPreS1xfwuRjNXBKfuiQhc653WIxC83grikBJWPvCW0Jcn6pyDayGpCS8g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=UpMISL5i; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7BDD606A322; Fri, 4 Dec 2026 11:33:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=UpMISL5i Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD0541F000C2; Fri, 4 Dec 2026 11:33:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384007; bh=uWn2l/bliH2vbyGZfri2TWWDM8JFfxA7jqDOWhF00Pw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UpMISL5if20UPpqTIBaqWQj/sD3S5P0qKoHDsiOpqwMoJKa+kfR/RajdGu7MRbqL6 rTlTAm5FEtKVBGWvs/elL1JvX86P6SC9J6E0TUpIRyiSEswVN7NsnnwDhB12WheFu7 /ygO8o+eYe7RmgbjPDi3qosbdPa0NV8c/J14lvDA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sebastian Reichel , Alexander Shiyan , Mark Brown Subject: [PATCH 6.12 454/555] spi: Fix runtime PM imbalance on pump transfer message error Date: Fri, 4 Dec 2026 19:08:17 +0900 Message-ID: <20261204100626.708081838@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sebastian Reichel commit bb5caf7a2e0b2dae8e8905d32fc376703eabcfc4 upstream. The current SPI message pumping code may drop the runtime PM twice when an SPI message cannot be sent: spi_master spi2: noqueue transfer failed rockchip-spi feb20000.spi: Runtime PM usage count underflow! Fix the problem by always keeping the runtime PM count increased when exiting __spi_pump_transfer_message(), as the caller handles decreasing it. Note, that the function already keeps the RPM usage counter increased for the error paths following after the prepare_transfer_hardware step. Cc: stable@vger.kernel.org Fixes: bef4a48f4ef7 ("spi: Fix null dereference on suspend") Signed-off-by: Sebastian Reichel Tested-by: Alexander Shiyan Link: https://patch.msgid.link/20261110-spi-runtime-pm-fix-v1-1-8601ebb2f6a8@collabora.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi.c | 4 ---- 1 file changed, 4 deletions(-) --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1752,7 +1752,6 @@ static int __spi_pump_transfer_message(s if (!was_busy && ctlr->auto_runtime_pm) { ret = pm_runtime_get_sync(ctlr->dev.parent); if (ret < 0) { - pm_runtime_put_noidle(ctlr->dev.parent); dev_err(&ctlr->dev, "Failed to power device: %d\n", ret); @@ -1773,9 +1772,6 @@ static int __spi_pump_transfer_message(s "failed to prepare transfer hardware: %d\n", ret); - if (ctlr->auto_runtime_pm) - pm_runtime_put(ctlr->dev.parent); - msg->status = ret; spi_finalize_current_message(ctlr);