* [PATCH] of: platform: Fix possible crash
@ 2014-01-07 18:48 Alexander Shiyan
2014-01-10 7:39 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Shiyan @ 2014-01-07 18:48 UTC (permalink / raw)
To: barebox
"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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] of: platform: Fix possible crash
2014-01-07 18:48 [PATCH] of: platform: Fix possible crash Alexander Shiyan
@ 2014-01-10 7:39 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2014-01-10 7:39 UTC (permalink / raw)
To: Alexander Shiyan; +Cc: barebox
On Tue, Jan 07, 2014 at 10:48:17PM +0400, Alexander Shiyan wrote:
> "dev" may uninitialized or points to incorrect device.
Nice catch. Applied and while at it made the message more informative:
debug("%s: register device %s, io=0x%08x\n", __func__, dev_name(dev),
(num_reg) ? dev->resource[0].start : (-1));
Sascha
>
> 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
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-01-10 7:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-07 18:48 [PATCH] of: platform: Fix possible crash Alexander Shiyan
2014-01-10 7:39 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox