From: Ben Dooks Date: Tue, 18 Oct 2005 06:51:34 +0000 (+0100) Subject: [ARM] 3018/1: S3C2410 - check de-referenced device is really a platform device X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c086f282c01d7e5a887c3f7b190520538267f12e;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git [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 Signed-off-by: Russell King --- diff --git a/arch/arm/mach-s3c2410/clock.c b/arch/arm/mach-s3c2410/clock.c index f5960826875..8b3d5dc35de 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) 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);