drm: clean dirty memory after device release
authorMa Ling <ling.ma@intel.com>
Thu, 16 Apr 2009 09:51:25 +0000 (17:51 +0800)
committerDave Airlie <airlied@redhat.com>
Mon, 20 Apr 2009 00:03:46 +0000 (10:03 +1000)
In current code we register/unregister connector object by
drm_sysfs_connector_add/remove function.

However under some cases, we need to dynamically register or unregister device
multiple times, so we have to go through register -> unregister ->register
routine.

Because after device_unregister function our memory is dirty, we need to do
clean operation in order to re-register the device, otherwise the system
will crash.  The patch intends to clean device after device release.

Signed-off-by: Ma Ling <ling.ma@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_sysfs.c

index bc0c6849360cd378d8129a7a362c4d3b176392a4..022876ae34f07f72b5906d50eabb936586d01e8d 100644 (file)
@@ -132,6 +132,7 @@ void drm_sysfs_destroy(void)
  */
 static void drm_sysfs_device_release(struct device *dev)
 {
+       memset(dev, 0, sizeof(struct device));
        return;
 }