All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix for depca driver
@ 2007-04-03 22:34 Andrea Righi
  0 siblings, 0 replies; only message in thread
From: Andrea Righi @ 2007-04-03 22:34 UTC (permalink / raw)
  To: linux-kernel

Hi all,

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().

-Andrea

---
 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 5113eef..f3807aa 100644
--- a/drivers/net/depca.c
+++ b/drivers/net/depca.c
@@ -1491,8 +1491,9 @@ static void __init depca_platform_probe
                depca_io_ports[i].device = pldev;

                if (platform_device_add(pldev)) {
-                       platform_device_put(pldev);
                        depca_io_ports[i].device = NULL;
+                       pldev->dev.platform_data = NULL;
+                       platform_device_put(pldev);
                        continue;
                }


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

only message in thread, other threads:[~2007-04-04  0:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-03 22:34 [PATCH] fix for depca driver Andrea Righi

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.