From: Florian Fainelli <florian@openwrt.org>
To: David Miller <davem@davemloft.net>,
jeff@garzik.org, netdev@vger.kernel.org,
Phil Sutter <n0-1@freewrt.org>
Subject: [PATCH] korina: fix probing crash
Date: Sun, 11 Jan 2009 16:54:24 +0100 [thread overview]
Message-ID: <200901111654.24651.florian@openwrt.org> (raw)
From: Florian Fainelli <florian@openwrt.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@openwrt.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");
next reply other threads:[~2009-01-11 15:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-11 15:54 Florian Fainelli [this message]
2009-01-13 5:52 ` [PATCH] korina: fix probing crash David Miller
[not found] ` <1231954874-31245-1-git-send-email-n0-1@freewrt.org>
2009-01-14 18:01 ` [PATCH] MIPS: rb532: use driver_data instead of platform_data Florian Fainelli
[not found] ` <1231955241-6440-1-git-send-email-n0-1@freewrt.org>
2009-01-15 5:47 ` [PATCH] korina: fix usage of driver_data David Miller
2009-01-15 14:41 ` [PATCH] MIPS: rb532: use driver_data instead of platform_data Phil Sutter
2009-01-29 17:34 ` Ralf Baechle
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=200901111654.24651.florian@openwrt.org \
--to=florian@openwrt.org \
--cc=davem@davemloft.net \
--cc=jeff@garzik.org \
--cc=n0-1@freewrt.org \
--cc=netdev@vger.kernel.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.