提交 c086f282 编写于 作者: B Ben Dooks 提交者: Russell King

[ARM] 3018/1: S3C2410 - check de-referenced device is really a platform device

Patch from Ben Dooks

Check that the device we are looking at is really
a platform device before trying to cast it to one
to find out the platform bus number.

Thanks to RMK for pointing this out.
Signed-off-by: NBen Dooks <ben-linux@fluff.org>
Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
上级 39ca371c
......@@ -98,7 +98,10 @@ struct clk *clk_get(struct device *dev, const char *id)
struct clk *clk = ERR_PTR(-ENOENT);
int idno;
idno = (dev == NULL) ? -1 : to_platform_device(dev)->id;
if (dev == NULL || dev->bus != &platform_bus_type)
idno = -1;
else
idno = to_platform_device(dev)->id;
down(&clocks_sem);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册