From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from smtp11.mail.ru ([94.100.176.85]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W0bhl-0008O7-L8 for barebox@lists.infradead.org; Tue, 07 Jan 2014 18:48:46 +0000 From: Alexander Shiyan Date: Tue, 7 Jan 2014 22:48:17 +0400 Message-Id: <1389120497-26828-1-git-send-email-shc_work@mail.ru> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH] of: platform: Fix possible crash To: barebox@lists.infradead.org "dev" may uninitialized or points to incorrect device. Signed-off-by: Alexander Shiyan --- 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