[PATCH] of: resource: add WARN for invalid release_resource calls

From: Robert ABEL
Date: Thu Jul 30 2015 - 09:17:33 EST


Signed-off-by: Robert ABEL <rabel@xxxxxxxxxxxxxxxxxxxxxxx>
---
kernel/resource.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/kernel/resource.c b/kernel/resource.c
index 0bcebff..b4c9b27 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -236,6 +236,13 @@ static int __release_resource(struct resource *old)
{
struct resource *tmp, **p;

+ /* devicetree overlays:
+ * of code doesn't initialize parent, child, sibling
+ * gracefully 'do the right thing' here
+ */
+ if (WARN(!old->parent, "%s: uninitialized resource %s\n", __FUNCTION__, old->name))
+ return 0;
+
p = &old->parent->child;
for (;;) {
tmp = *p;
--
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/