All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Thumshirn <morbidrsa@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>,
	Sachin Kamat <sachin.kamat@linaro.org>,
	Peter Meerwald <pmeerw@pmeerw.net>
Cc: ohannes Thumshirn <morbidrsa@gmail.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] iio: adc: viperboard: Call platform_set_drvdata before devm_iio_device_register
Date: Sat,  1 Feb 2014 15:39:53 +0100	[thread overview]
Message-ID: <1391265593-13986-1-git-send-email-morbidrsa@gmail.com> (raw)

Call platform_set_drvdata before devm_iio_device_register to avoid possible
race condition when accessing driver data.

Signed-off-by: Johannes Thumshirn <morbidrsa@gmail.com>
---
 drivers/iio/adc/viperboard_adc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/viperboard_adc.c b/drivers/iio/adc/viperboard_adc.c
index d0add8f..7d9bd05 100644
--- a/drivers/iio/adc/viperboard_adc.c
+++ b/drivers/iio/adc/viperboard_adc.c
@@ -133,14 +133,14 @@ static int vprbrd_adc_probe(struct platform_device *pdev)
 	indio_dev->channels = vprbrd_adc_iio_channels;
 	indio_dev->num_channels = ARRAY_SIZE(vprbrd_adc_iio_channels);
 
+	platform_set_drvdata(pdev, indio_dev);
+
 	ret = devm_iio_device_register(&pdev->dev, indio_dev);
 	if (ret) {
 		dev_err(&pdev->dev, "could not register iio (adc)");
 		return ret;
 	}
 
-	platform_set_drvdata(pdev, indio_dev);
-
 	return 0;
 }
 
-- 
1.8.5.3


             reply	other threads:[~2014-02-01 14:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-01 14:39 Johannes Thumshirn [this message]
2014-02-01 14:46 ` [PATCH] iio: adc: viperboard: Call platform_set_drvdata before devm_iio_device_register Lars-Peter Clausen
2014-02-01 14:49   ` Johannes Thumshirn

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=1391265593-13986-1-git-send-email-morbidrsa@gmail.com \
    --to=morbidrsa@gmail.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=sachin.kamat@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 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.