From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754984AbcGEUG3 (ORCPT ); Tue, 5 Jul 2016 16:06:29 -0400 Received: from saturn.retrosnub.co.uk ([178.18.118.26]:42631 "EHLO saturn.retrosnub.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751257AbcGEUGZ (ORCPT ); Tue, 5 Jul 2016 16:06:25 -0400 Subject: Re: [PATCH v1] drivers:iio:accel:mma8452: added cleanup provision in case of failure. To: Martin Kepplinger , Bijosh Thykkoottathil , "knaack.h@gmx.de" , "lars@metafoo.de" , "pmeerw@pmeerw.net" , "christoph.muellner@theobroma-systems.com" References: Cc: "linux-iio@vger.kernel.org" , "linux-kernel@vger.kernel.org" From: Jonathan Cameron Message-ID: <1522837d-ce30-2d2c-12d3-0defe7835085@kernel.org> Date: Tue, 5 Jul 2016 21:06:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/07/16 21:02, Jonathan Cameron wrote: > On 04/07/16 13:20, Martin Kepplinger wrote: >> Am 2016-07-04 um 12:08 schrieb Bijosh Thykkoottathil: >>> mma8452_set_freefall_mode can return -ve value in case if >>> i2c_smbus_read_byte_data fails. This function is called from mma8452_probe, >>> and returning -ve value from probe indicates probe failure. Need to call >>> iio_triggered_buffer_cleanup & iio_trigger_cleanup in this case. >> >> Thanks for your review, nice catch! Looks good to me. You just could >> have said "Don't leak allocated buffer on error during probe().", but oh >> well :) >> >>> >>> Signed-off-by: Bijosh Thykkoottathil >> Reviewed-by: Martin Kepplinger > Applied, thanks. Flipped this one over to an Acked-by as well for same reason as the other patch though even more so here! > > Jonathan >> >>> --- >>> drivers/iio/accel/mma8452.c | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c >>> index e225d3c..1bcf5c3 100644 >>> --- a/drivers/iio/accel/mma8452.c >>> +++ b/drivers/iio/accel/mma8452.c >>> @@ -1444,8 +1444,8 @@ static int mma8452_probe(struct i2c_client *client, >>> goto buffer_cleanup; >>> >>> ret = mma8452_set_freefall_mode(data, false); >>> - if (ret) >>> - return ret; >>> + if (ret < 0) >>> + goto buffer_cleanup; >>> >>> return 0; >>> >>> > > -- > To unsubscribe from this list: send the line "unsubscribe linux-iio" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >