From: David Lechner Date: Thu, 25 Jan 2024 20:53:09 +0000 (-0600) Subject: spi: fix finalize message on error return X-Git-Tag: v6.6.15~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0232a19a0e215e1630ea821fd83fcf8d2de39b21;p=thirdparty%2Fkernel%2Fstable.git spi: fix finalize message on error return [ Upstream commit 8c2ae772fe08e33f3d7a83849e85539320701abd ] In __spi_pump_transfer_message(), the message was not finalized in the first error return as it is in the other error return paths. Not finalizing the message could cause anything waiting on the message to complete to hang forever. This adds the missing call to spi_finalize_current_message(). Fixes: ae7d2346dc89 ("spi: Don't use the message queue if possible in spi_sync") Signed-off-by: David Lechner Link: https://msgid.link/r/20240125205312.3458541-2-dlechner@baylibre.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 399e81d37b3ba..1e08cd571d21a 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1624,6 +1624,10 @@ static int __spi_pump_transfer_message(struct spi_controller *ctlr, pm_runtime_put_noidle(ctlr->dev.parent); dev_err(&ctlr->dev, "Failed to power device: %d\n", ret); + + msg->status = ret; + spi_finalize_current_message(ctlr); + return ret; } }