All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] rdc321x-wtd: fix null pointer dereference while accessing platform_data
@ 2010-11-26  9:39 Florian Fainelli
  0 siblings, 0 replies; only message in thread
From: Florian Fainelli @ 2010-11-26  9:39 UTC (permalink / raw)
  To: sameo; +Cc: linux-kernel, Wim Van Sebroeck

[-- Attachment #1: Type: text/plain, Size: 920 bytes --]

rdc321x-wdt currently fetches its driver specific data by using the platform_
device->platform_data pointer, this is wrong because the mfd device which
registers our platform_device has been added using mfd_add_device() which sets
the platform_device->driver_data pointer instead.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
CC: stable@kernel.org
---
This patch should be applied for the next 2.6.36 stable release.

diff --git a/drivers/watchdog/rdc321x_wdt.c b/drivers/watchdog/rdc321x_wdt.c
index 428f8a1..3939e53 100644
--- a/drivers/watchdog/rdc321x_wdt.c
+++ b/drivers/watchdog/rdc321x_wdt.c
@@ -231,7 +231,7 @@ static int __devinit rdc321x_wdt_probe(struct platform_device *pdev)
 	struct resource *r;
 	struct rdc321x_wdt_pdata *pdata;
 
-	pdata = pdev->dev.platform_data;
+	pdata = platform_get_drvdata(pdev);
 	if (!pdata) {
 		dev_err(&pdev->dev, "no platform data supplied\n");
 		return -ENODEV;

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: e28c923a79c0547fcbaa0bd3d5007c111d9b485f.diff --]
[-- Type: text/x-patch; name="e28c923a79c0547fcbaa0bd3d5007c111d9b485f.diff", Size: 492 bytes --]

diff --git a/drivers/watchdog/rdc321x_wdt.c b/drivers/watchdog/rdc321x_wdt.c
index 428f8a1..3939e53 100644
--- a/drivers/watchdog/rdc321x_wdt.c
+++ b/drivers/watchdog/rdc321x_wdt.c
@@ -231,7 +231,7 @@ static int __devinit rdc321x_wdt_probe(struct platform_device *pdev)
 	struct resource *r;
 	struct rdc321x_wdt_pdata *pdata;
 
-	pdata = pdev->dev.platform_data;
+	pdata = platform_get_drvdata(pdev);
 	if (!pdata) {
 		dev_err(&pdev->dev, "no platform data supplied\n");
 		return -ENODEV;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-11-26  9:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-26  9:39 [PATCH 2/2] rdc321x-wtd: fix null pointer dereference while accessing platform_data Florian Fainelli

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.