Driver core: platform_device_unregister should release resources first
and only then call device_unregister, otherwise if there
are no more references to the device it will be freed and
the fucntion will try to access freed memory.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
int i;
if (pdev) {
- device_unregister(&pdev->dev);
-
for (i = 0; i < pdev->num_resources; i++) {
struct resource *r = &pdev->resource[i];
if (r->flags & (IORESOURCE_MEM|IORESOURCE_IO))
release_resource(r);
}
+
+ device_unregister(&pdev->dev);
}
}