From: Martin Sperl <kernel@xxxxxxxxxxxxxxxx> Signed-off-by: Martin Sperl <kernel@xxxxxxxxxxxxxxxx> --- drivers/spi/spi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) applies against for-next diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index d35c1a1..a73d9e4 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -620,6 +620,7 @@ static int spi_map_msg(struct spi_master *master, struct spi_message *msg) struct spi_transfer *xfer; void *tmp; unsigned int max_tx, max_rx; + int ret; if (master->flags & (SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX)) { max_tx = 0; @@ -662,7 +663,11 @@ static int spi_map_msg(struct spi_master *master, struct spi_message *msg) } } - return __spi_map_msg(master, msg); + ret = __spi_map_msg(master, msg); + if (ret) + spi_unmap_msg(master, msg); + + return ret; } /* -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html