diff options
author | Ben Dooks <ben-linux@fluff.org> | 2005-10-18 02:51:34 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-10-18 02:51:34 -0400 |
commit | c086f282c01d7e5a887c3f7b190520538267f12e (patch) | |
tree | 242684c30b3bcd8fd15046af94aa3c7874521690 /arch | |
parent | 39ca371c45b04cd50d0974030ae051906fc516b6 (diff) |
[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: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-s3c2410/clock.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/arm/mach-s3c2410/clock.c b/arch/arm/mach-s3c2410/clock.c index f59608268751..8b3d5dc35de5 100644 --- a/arch/arm/mach-s3c2410/clock.c +++ b/arch/arm/mach-s3c2410/clock.c | |||
@@ -98,7 +98,10 @@ struct clk *clk_get(struct device *dev, const char *id) | |||
98 | struct clk *clk = ERR_PTR(-ENOENT); | 98 | struct clk *clk = ERR_PTR(-ENOENT); |
99 | int idno; | 99 | int idno; |
100 | 100 | ||
101 | idno = (dev == NULL) ? -1 : to_platform_device(dev)->id; | 101 | if (dev == NULL || dev->bus != &platform_bus_type) |
102 | idno = -1; | ||
103 | else | ||
104 | idno = to_platform_device(dev)->id; | ||
102 | 105 | ||
103 | down(&clocks_sem); | 106 | down(&clocks_sem); |
104 | 107 | ||