From patchwork Sun May 24 09:34:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sperl X-Patchwork-Id: 6471511 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4C8D79F1CC for ; Sun, 24 May 2015 09:35:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 30576205B7 for ; Sun, 24 May 2015 09:35:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C8F252057E for ; Sun, 24 May 2015 09:34:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750858AbbEXJe5 (ORCPT ); Sun, 24 May 2015 05:34:57 -0400 Received: from 212-186-180-163.dynamic.surfer.at ([212.186.180.163]:50818 "EHLO cgate.sperl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750795AbbEXJe5 (ORCPT ); Sun, 24 May 2015 05:34:57 -0400 Received: from raspb.intern.sperl.org (account martin@sperl.org [10.10.10.32] verified) by sperl.org (CommuniGate Pro SMTP 6.1.2) with ESMTPSA id 6330015; Sun, 24 May 2015 09:34:54 +0000 From: kernel@martin.sperl.org To: Mark Brown , linux-spi@vger.kernel.org Cc: Martin Sperl Subject: [PATCH] spi: add missing cleanup in spi_map_msg on error Date: Sun, 24 May 2015 09:34:46 +0000 Message-Id: <1432460086-2549-1-git-send-email-kernel@martin.sperl.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <2B971A09-33E3-42BC-B13D-49B6DD3D2E7A@martin.sperl.org> References: <2B971A09-33E3-42BC-B13D-49B6DD3D2E7A@martin.sperl.org> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Martin Sperl Signed-off-by: Martin Sperl --- 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; } /*