public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c-davinci: Fix use of default platform data if none supplied.
@ 2010-09-04 16:07 Michael Williamson
  2010-09-22  0:24 ` Ben Dooks
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Williamson @ 2010-09-04 16:07 UTC (permalink / raw)
  To: linux-i2c, linux-kernel
  Cc: ben-linux, khilman, chaithrika, pjohn, nageswari, dirk.behme,
	Michael Williamson

There is a bug in the i2c-davinci device init routine that attempts
to use default platform data if none is supplied (e.g., is NULL).
This patch fixes the bug.

Signed-off-by: Michael Williamson <michael.williamson@criticallink.com>
---
 drivers/i2c/busses/i2c-davinci.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index 2222c87..6d4eeeb 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -235,10 +235,12 @@ static void i2c_davinci_calc_clk_dividers(struct davinci_i2c_dev *dev)
  */
 static int i2c_davinci_init(struct davinci_i2c_dev *dev)
 {
-	struct davinci_i2c_platform_data *pdata = dev->dev->platform_data;
+	struct davinci_i2c_platform_data *pdata;
 
-	if (!pdata)
-		pdata = &davinci_i2c_platform_data_default;
+	if (!dev->dev->platform_data)
+		dev->dev->platform_data = &davinci_i2c_platform_data_default;
+
+	pdata = dev->dev->platform_data;
 
 	/* put I2C into reset */
 	davinci_i2c_reset_ctrl(dev, 0);
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-09-22  1:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-04 16:07 [PATCH] i2c-davinci: Fix use of default platform data if none supplied Michael Williamson
2010-09-22  0:24 ` Ben Dooks
2010-09-22  1:02   ` Michael Williamson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox