Skip to content

Commit

Permalink
[ARM] 3018/1: S3C2410 - check de-referenced device is really a platfo…
Browse files Browse the repository at this point in the history
…rm 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: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Ben Dooks authored and Russell King committed Oct 18, 2005
1 parent 39ca371 commit c086f28
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion arch/arm/mach-s3c2410/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit c086f28

Please sign in to comment.