From: Jonathan Cameron <jic23@kernel.org>
To: Martin Kepplinger <martink@posteo.de>,
Bijosh Thykkoottathil <bijosh.t@hotmail.com>,
"knaack.h@gmx.de" <knaack.h@gmx.de>,
"lars@metafoo.de" <lars@metafoo.de>,
"pmeerw@pmeerw.net" <pmeerw@pmeerw.net>,
"christoph.muellner@theobroma-systems.com"
<christoph.muellner@theobroma-systems.com>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1] drivers:iio:accel:mma8452: added cleanup provision in case of failure.
Date: Tue, 5 Jul 2016 21:02:41 +0100 [thread overview]
Message-ID: <d26d071a-47b2-2c69-4718-233ae0d9b13d@kernel.org> (raw)
In-Reply-To: <e07d6110-9df7-ace2-ebff-dd63886ab16a@posteo.de>
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 <bijosh.t@hotmail.com>
> Reviewed-by: Martin Kepplinger <martink@posteo.de>
Applied, thanks.
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;
>>
>>
next prev parent reply other threads:[~2016-07-05 20:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-04 10:08 [PATCH v1] drivers:iio:accel:mma8452: added cleanup provision in case of failure Bijosh Thykkoottathil
2016-07-04 12:20 ` Martin Kepplinger
2016-07-05 20:02 ` Jonathan Cameron [this message]
2016-07-05 20:06 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d26d071a-47b2-2c69-4718-233ae0d9b13d@kernel.org \
--to=jic23@kernel.org \
--cc=bijosh.t@hotmail.com \
--cc=christoph.muellner@theobroma-systems.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martink@posteo.de \
--cc=pmeerw@pmeerw.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).