diff options
author | Guenter Roeck <linux@roeck-us.net> | 2016-09-13 23:32:44 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-09-27 06:30:37 -0400 |
commit | 60ca5e0d280b1a51df55c5fc2e5bfe010b344c5a (patch) | |
tree | 3389804982b1d415687846bb67308b646cf5320b /drivers/base | |
parent | 78618d395b65fadb2937a985308c3a4d2897ade2 (diff) |
driver-core: platform: Catch errors from calls to irq_get_irq_data
irq_get_irq_data() can return NULL, which results in a nasty crash.
Check its return value before passing it on to irqd_set_trigger_type().
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/platform.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 44c9d4daf510..c4af00385502 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -108,9 +108,14 @@ int platform_get_irq(struct platform_device *dev, unsigned int num) | |||
108 | * IORESOURCE_BITS correspond 1-to-1 to the IRQF_TRIGGER* | 108 | * IORESOURCE_BITS correspond 1-to-1 to the IRQF_TRIGGER* |
109 | * settings. | 109 | * settings. |
110 | */ | 110 | */ |
111 | if (r && r->flags & IORESOURCE_BITS) | 111 | if (r && r->flags & IORESOURCE_BITS) { |
112 | irqd_set_trigger_type(irq_get_irq_data(r->start), | 112 | struct irq_data *irqd; |
113 | r->flags & IORESOURCE_BITS); | 113 | |
114 | irqd = irq_get_irq_data(r->start); | ||
115 | if (!irqd) | ||
116 | return -ENXIO; | ||
117 | irqd_set_trigger_type(irqd, r->flags & IORESOURCE_BITS); | ||
118 | } | ||
114 | 119 | ||
115 | return r ? r->start : -ENXIO; | 120 | return r ? r->start : -ENXIO; |
116 | #endif | 121 | #endif |