aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/platform.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 063f0ab15259..f80aaaf9f610 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -375,9 +375,7 @@ int platform_device_add(struct platform_device *pdev)
375 375
376 while (--i >= 0) { 376 while (--i >= 0) {
377 struct resource *r = &pdev->resource[i]; 377 struct resource *r = &pdev->resource[i];
378 unsigned long type = resource_type(r); 378 if (r->parent)
379
380 if (type == IORESOURCE_MEM || type == IORESOURCE_IO)
381 release_resource(r); 379 release_resource(r);
382 } 380 }
383 381
@@ -408,9 +406,7 @@ void platform_device_del(struct platform_device *pdev)
408 406
409 for (i = 0; i < pdev->num_resources; i++) { 407 for (i = 0; i < pdev->num_resources; i++) {
410 struct resource *r = &pdev->resource[i]; 408 struct resource *r = &pdev->resource[i];
411 unsigned long type = resource_type(r); 409 if (r->parent)
412
413 if (type == IORESOURCE_MEM || type == IORESOURCE_IO)
414 release_resource(r); 410 release_resource(r);
415 } 411 }
416 } 412 }