[PATCH] of: platform: Fix possible crash
Alexander Shiyan
shc_work at mail.ru
Tue Jan 7 13:48:17 EST 2014
"dev" may uninitialized or points to incorrect device.
Signed-off-by: Alexander Shiyan <shc_work at 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
More information about the barebox
mailing list