mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Alexander Shiyan <shc_work@mail.ru>
To: barebox@lists.infradead.org
Subject: [PATCH] of: platform: Fix possible crash
Date: Tue,  7 Jan 2014 22:48:17 +0400	[thread overview]
Message-ID: <1389120497-26828-1-git-send-email-shc_work@mail.ru> (raw)

"dev" may uninitialized or points to incorrect device.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/of/platform.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index e75a69b..5cd32fc 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -174,9 +174,6 @@ static struct device_d *of_platform_device_create(struct device_node *np,
 		}
 	}
 
-	debug("register device 0x%08x\n",
-		(num_reg) ? dev->resource[0].start : (-1));
-
 	/* setup generic device info */
 	dev = xzalloc(sizeof(*dev));
 	dev->id = DEVICE_ID_SINGLE;
@@ -186,6 +183,9 @@ static struct device_d *of_platform_device_create(struct device_node *np,
 	dev->num_resources = num_reg;
 	of_device_make_bus_id(dev);
 
+	debug("register device 0x%08x\n",
+		(num_reg) ? dev->resource[0].start : (-1));
+
 	ret = platform_device_register(dev);
 	if (!ret)
 		return dev;
-- 
1.8.3.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2014-01-07 18:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-07 18:48 Alexander Shiyan [this message]
2014-01-10  7:39 ` Sascha Hauer

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=1389120497-26828-1-git-send-email-shc_work@mail.ru \
    --to=shc_work@mail.ru \
    --cc=barebox@lists.infradead.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