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=1796382621; b=xMNEO+HhYkEQ7lqtixFZ16Qi8hjkAPJgXJgz0uVJc59vkIlvTeQs9NEcg+AIDq/xdWmd 7NHLTbRFZPgtqGdS0Kr6HfweCaHzQQmM68m50kfO4NNxSq+UeJG0bkO+ZqqtSPC9QT6bO 4wR8iDTxUk5z74EG1ONCtGWhQJ8PfpiJi12EOD26AeJqRJb4HpwbuFiVTnyVAUuZ7L+sY 6izcJF33dLh+vxH1JJY8vkI9b8CS00tJ6H+Das7tc0Hjdcy5nx5IOtF3d2XnYK33wEAsb if9DVQ7/4dwJfF7ZYoJEj47ql98O2qsprvSgfhHz7QmB+Z2OJtbIRbDq80DMBlK2xRw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382621; 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=skSbMhBxBfglpMK0nJ9XY1bl1BQQxkRn8ZbapaLqKV8=; b=AeFbjrXvzQDSUA3fe4PMcHdECTcc6d13kjJ1YOQwklTrSRkRaF6/IwySLIVMmhW0hgI2 eow0cV7YS8LPs4DJMAxiSP09wTAh8I1X5K86UV/DamWGxzWVNdoCIi+ZraJMdT8rsEp/G Vjylz0uwgP1yBww2k34LjlUFs2ulFtwUeTMlqhJPLlHsuSoNukKC2uYaOrp6yZQBFUJel ujya1EYUZOM8sw63PW/1PCB1sJTqlRrMTjqZ6AmhbNEUbA6OOR8JugcoKaTMSJp4SFp45 PM0a2meVYSwJSaYS1Buu1bg8FulwyrWJgtWHVfQESQM4yRGmXa8h906F6l/vOLxPn4g== 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="ftI/FbbD"; 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 F1296606A334; Fri, 4 Dec 2026 11:10:20 +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=ftI/FbbD Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22BD61F00937; Fri, 4 Dec 2026 11:10:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382620; bh=skSbMhBxBfglpMK0nJ9XY1bl1BQQxkRn8ZbapaLqKV8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ftI/FbbD/5e1tPGgRfmppb3AsKbRK2f15nna9vvd/M/IjUuMH6Ki+6mP28JQkEmCy 7o9RvFlUkgb5jsEd1KHsntuO24olnf7J22C4z6s4wDVG6wD09xMiL8UExTU9cdVPqf t/56JjlhksOVUjeFGeQtYjzZCTq/IzRbjcuYJouU= 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.18 531/703] spi: Fix runtime PM imbalance on pump transfer message error Date: Fri, 4 Dec 2026 19:07:10 +0900 Message-ID: <20261204100641.916590405@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@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.18-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 @@ -1735,7 +1735,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); @@ -1756,9 +1755,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);