[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <200901111654.24651.florian@openwrt.org>
Date: Sun, 11 Jan 2009 16:54:24 +0100
From: Florian Fainelli <florian@...nwrt.org>
To: David Miller <davem@...emloft.net>, jeff@...zik.org,
netdev@...r.kernel.org, Phil Sutter <n0-1@...ewrt.org>
Subject: [PATCH] korina: fix probing crash
From: Florian Fainelli <florian@...nwrt.org>
Subject: [PATCH] korina: fix probing crash
This patch fixes the wrong retrieval of platform_data
which makes the driver crash on probe. Propagate error
if the platform_driver cannot use its data.
Signed-off-by: Florian Fainelli <florian@...nwrt.org>
---
diff --git a/drivers/net/korina.c b/drivers/net/korina.c
index e185763..b2a3949 100644
--- a/drivers/net/korina.c
+++ b/drivers/net/korina.c
@@ -1078,12 +1078,18 @@ static int korina_close(struct net_device *dev)
static int korina_probe(struct platform_device *pdev)
{
- struct korina_device *bif = platform_get_drvdata(pdev);
+ struct korina_device *bif;
struct korina_private *lp;
struct net_device *dev;
struct resource *r;
int rc;
+ bif = (struct korina_device *)pdev->dev.platform_data;
+ if (!bif) {
+ printk(KERN_ERR DRV_NAME ": missing platform data\n");
+ return -ENODEV;
+ }
+
dev = alloc_etherdev(sizeof(struct korina_private));
if (!dev) {
printk(KERN_ERR DRV_NAME ": alloc_etherdev failed\n");
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists