From patchwork Mon Apr 2 16:59:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 10320067 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AB38A602C8 for ; Mon, 2 Apr 2018 16:59:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B4B628973 for ; Mon, 2 Apr 2018 16:59:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F25F289C6; Mon, 2 Apr 2018 16:59:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA52228973 for ; Mon, 2 Apr 2018 16:59:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753035AbeDBQ7s (ORCPT ); Mon, 2 Apr 2018 12:59:48 -0400 Received: from smtp08.smtpout.orange.fr ([80.12.242.130]:43087 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752878AbeDBQ7r (ORCPT ); Mon, 2 Apr 2018 12:59:47 -0400 Received: from ubuntu-CJ.home ([86.244.119.222]) by mwinf5d43 with ME id VUzk1x00E4nzehS03UzkUz; Mon, 02 Apr 2018 18:59:45 +0200 X-ME-Helo: ubuntu-CJ.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 02 Apr 2018 18:59:45 +0200 X-ME-IP: 86.244.119.222 From: Christophe JAILLET To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, nfarnesi4@gmail.com Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH 1/2] iio: sca3000: Fix an error handling path in 'sca3000_probe()' Date: Mon, 2 Apr 2018 18:59:42 +0200 Message-Id: <20180402165942.9056-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.14.1 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In case of error, we must undo the previous 'sca3000_configure_ring()' call in order to free some memory. Signed-off-by: Christophe JAILLET --- drivers/iio/accel/sca3000.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c index f33dadf7b262..dae4c594c170 100644 --- a/drivers/iio/accel/sca3000.c +++ b/drivers/iio/accel/sca3000.c @@ -1496,7 +1496,7 @@ static int sca3000_probe(struct spi_device *spi) "sca3000", indio_dev); if (ret) - return ret; + goto error_unconfigure_ring; } indio_dev->setup_ops = &sca3000_ring_setup_ops; ret = sca3000_clean_setup(st); @@ -1513,6 +1513,9 @@ static int sca3000_probe(struct spi_device *spi) if (spi->irq) free_irq(spi->irq, indio_dev); +error_unconfigure_ring: + sca3000_unconfigure_ring(indio_dev); + return ret; }