devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert ABEL <rabel@cit-ec.uni-bielefeld.de>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	Robert ABEL <rabel@cit-ec.uni-bielefeld.de>
Subject: [PATCH] of: resource: add WARN for invalid release_resource calls
Date: Thu, 30 Jul 2015 15:17:17 +0200	[thread overview]
Message-ID: <1438262237-30889-2-git-send-email-rabel@cit-ec.uni-bielefeld.de> (raw)
In-Reply-To: <1438262237-30889-1-git-send-email-rabel@cit-ec.uni-bielefeld.de>

Signed-off-by: Robert ABEL <rabel@cit-ec.uni-bielefeld.de>
---
 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

  reply	other threads:[~2015-07-30 13:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <[PATCH v3 0/7] Introducing (yet again) Device Tree Overlays>
2015-07-30 13:17 ` of: dynamic: resource: add WARN in release_resource for DT overlays Robert ABEL
2015-07-30 13:17   ` Robert ABEL [this message]
2015-08-05 21:04   ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1438262237-30889-2-git-send-email-rabel@cit-ec.uni-bielefeld.de \
    --to=rabel@cit-ec.uni-bielefeld.de \
    --cc=akpm@linux-foundation.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).