From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>, Denis CIOCCA <denis.ciocca@st.com>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH 1/4] iio:accel: call devm_iio_device_free function if common_proble fails
Date: Sat, 15 Feb 2014 09:47:46 +0000 [thread overview]
Message-ID: <52FF37C2.5030600@kernel.org> (raw)
In-Reply-To: <52FE404B.3050307@metafoo.de>
On 14/02/14 16:11, Lars-Peter Clausen wrote:
> On 02/14/2014 04:16 PM, Denis CIOCCA wrote:
>> If st_accel_common_probe function fails, the device must be freed.
>> Added devm_iio_device_free also on common_remove function.
>
> When the device is allocated with devm_iio_device... you do not need to manually free the device. If probe fails the device will be freed automatically.
>
> - Lars
Indeed - the handling in these drivers appears entirely correct.
The allocs are done with devm so under any error conditions or
deliberate removal they will be cleared up.
The register should not be done using devm as that would mean the
unregister would occur late. As the register is done last, there
are no error conditions that can require it being removed in the
probe function. Hence the code looks fine to me as it stands.
So Denis, do you have an observed problem that prompted these patches?
Jonathan
next prev parent reply other threads:[~2014-02-15 9:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-14 15:16 use devm_iio_device_free on common probe failed and remove Denis CIOCCA
2014-02-14 15:16 ` [PATCH 1/4] iio:accel: call devm_iio_device_free function if common_proble fails Denis CIOCCA
2014-02-14 16:11 ` Lars-Peter Clausen
2014-02-15 9:47 ` Jonathan Cameron [this message]
2014-02-14 15:16 ` [PATCH 2/4] iio:gyro: " Denis CIOCCA
2014-02-14 15:16 ` [PATCH 3/4] iio:magnetometer: " Denis CIOCCA
2014-02-14 15:16 ` [PATCH 4/4] iio:pressure: " Denis CIOCCA
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=52FF37C2.5030600@kernel.org \
--to=jic23@kernel.org \
--cc=denis.ciocca@st.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
/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).