From: Marek Vasut <marex@denx.de>
To: linux-iio@vger.kernel.org
Cc: otavio@ossystems.com.br, Marek Vasut <marex@denx.de>,
Fabio Estevam <fabio.estevam@freescale.com>,
Jonathan Cameron <jic23@kernel.org>,
Shawn Guo <shawn.guo@linaro.org>
Subject: [PATCH] iio: mxs-lradc: Fix misuse of iio->trig
Date: Sat, 29 Jun 2013 23:20:13 +0200 [thread overview]
Message-ID: <1372540813-12540-1-git-send-email-marex@denx.de> (raw)
The struct iio_dev .trig field is to be used only by the IIO core,
the driver shall not fill this field. This fixes ugly crash when
the driver is compiled as a module and the module is rmmod'd.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Shawn Guo <shawn.guo@linaro.org>
---
drivers/staging/iio/adc/mxs-lradc.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index 55a459b..28e029a 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -664,12 +664,13 @@ static int mxs_lradc_trigger_init(struct iio_dev *iio)
{
int ret;
struct iio_trigger *trig;
+ struct mxs_lradc *lradc = iio_priv(iio);
trig = iio_trigger_alloc("%s-dev%i", iio->name, iio->id);
if (trig == NULL)
return -ENOMEM;
- trig->dev.parent = iio->dev.parent;
+ trig->dev.parent = lradc->dev;
trig->private_data = iio;
trig->ops = &mxs_lradc_trigger_ops;
@@ -679,15 +680,17 @@ static int mxs_lradc_trigger_init(struct iio_dev *iio)
return ret;
}
- iio->trig = trig;
+ lradc->trig = trig;
return 0;
}
static void mxs_lradc_trigger_remove(struct iio_dev *iio)
{
- iio_trigger_unregister(iio->trig);
- iio_trigger_free(iio->trig);
+ struct mxs_lradc *lradc = iio_priv(iio);
+
+ iio_trigger_unregister(lradc->trig);
+ iio_trigger_free(lradc->trig);
}
static int mxs_lradc_buffer_preenable(struct iio_dev *iio)
--
1.7.10.4
next reply other threads:[~2013-06-29 21:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-29 21:20 Marek Vasut [this message]
2013-07-03 19:50 ` [PATCH] iio: mxs-lradc: Fix misuse of iio->trig Jonathan Cameron
2013-07-03 21:47 ` Marek Vasut
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=1372540813-12540-1-git-send-email-marex@denx.de \
--to=marex@denx.de \
--cc=fabio.estevam@freescale.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=otavio@ossystems.com.br \
--cc=shawn.guo@linaro.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