diff options
author | Andrea Righi <a.righi@cineca.it> | 2007-04-24 12:40:57 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-04-24 12:40:57 -0400 |
commit | d91c088b39e3c66d309938de858775bb90fd1ead (patch) | |
tree | 5ea1c77374e894b6218b764324fe1200290a4c40 | |
parent | 4bf3631cdb012591667ab927fcd7719d92837833 (diff) |
[netdrvr] depca: handle platform_device_add() failure
The following patch fixes a kernel bug in depca_platform_probe().
We don't use a dynamic pointer for pldev->dev.platform_data, so it seems
that the correct way to proceed if platform_device_add(pldev) fails is
to explicitly set the pldev->dev.platform_data pointer to NULL, before
calling the platform_device_put(pldev), or it will be kfree'ed by
platform_device_release().
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/net/depca.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/depca.c b/drivers/net/depca.c index 5113eef755b9..f3807aaf10aa 100644 --- a/drivers/net/depca.c +++ b/drivers/net/depca.c | |||
@@ -1491,8 +1491,9 @@ static void __init depca_platform_probe (void) | |||
1491 | depca_io_ports[i].device = pldev; | 1491 | depca_io_ports[i].device = pldev; |
1492 | 1492 | ||
1493 | if (platform_device_add(pldev)) { | 1493 | if (platform_device_add(pldev)) { |
1494 | platform_device_put(pldev); | ||
1495 | depca_io_ports[i].device = NULL; | 1494 | depca_io_ports[i].device = NULL; |
1495 | pldev->dev.platform_data = NULL; | ||
1496 | platform_device_put(pldev); | ||
1496 | continue; | 1497 | continue; |
1497 | } | 1498 | } |
1498 | 1499 | ||