From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alison Schofield <amsfield22@gmail.com>
Cc: jic23@kernel.org, devel@driverdev.osuosl.org, lars@metafoo.de,
Michael.Hennerich@analog.com, linux-iio@vger.kernel.org,
gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
pmeerw@pmeerw.net, knaack.h@gmx.de
Subject: Re: [PATCH] iio: trigger: free trigger resource correctly
Date: Wed, 18 Jan 2017 12:56:29 +0300 [thread overview]
Message-ID: <20170118095629.GA4454@mwanda> (raw)
In-Reply-To: <20170118030016.GA23724@d830.WORKGROUP>
On Tue, Jan 17, 2017 at 07:00:28PM -0800, Alison Schofield wrote:
> Using iio_trigger_put() to free a trigger leads to release of
> a resource we never held. Replace with iio_trigger_free().
They're basically the same except iio_trigger_put() puts the module and
the device and free only puts the device.
I've looked at this briefly, but I can't figure out how iio_trigger_get/
iio_trigger_put is supposed to be used. There isn't any documentation.
I'm trying to review this code, but I can't figure out where we *are*
supposed to be doing the put.
For example, iio_device_unregister_trigger_consumer() takes a put, but
iio_device_register_trigger_consumer() doesn't do a get... It's all
very confusing.
You seem like you know what's going on. Can we get some documentation?
>
> Signed-off-by: Alison Schofield <amsfield22@gmail.com>
> ---
> Patches to use devm_* funcs are ready to follow this for
> the interrupt & bfin-timer triggers.
>
> drivers/iio/trigger/iio-trig-interrupt.c | 4 ++--
> drivers/iio/trigger/iio-trig-sysfs.c | 2 +-
> drivers/staging/iio/trigger/iio-trig-bfin-timer.c | 4 ++--
> 3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/trigger/iio-trig-interrupt.c b/drivers/iio/trigger/iio-trig-interrupt.c
> index 572bc6f..b18e50d 100644
> --- a/drivers/iio/trigger/iio-trig-interrupt.c
> +++ b/drivers/iio/trigger/iio-trig-interrupt.c
> @@ -84,7 +84,7 @@ static int iio_interrupt_trigger_probe(struct platform_device *pdev)
> error_free_trig_info:
> kfree(trig_info);
> error_put_trigger:
> - iio_trigger_put(trig);
> + iio_trigger_free(trig);
We could rename this label.
regards,
dan carpenter
next prev parent reply other threads:[~2017-01-18 9:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-18 3:00 [PATCH] iio: trigger: free trigger resource correctly Alison Schofield
2017-01-18 9:56 ` Dan Carpenter [this message]
2017-01-18 23:11 ` Alison Schofield
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=20170118095629.GA4454@mwanda \
--to=dan.carpenter@oracle.com \
--cc=Michael.Hennerich@analog.com \
--cc=amsfield22@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.