On Tue, Dec 05, 2017 at 11:41:52PM +0530, Arvind Yadav wrote:Yes, you are right. Few driver is using DEFINE_RES_IRQ(0).
Function platform_get_irq() can return 0. Which means NO_IRQ.You need to audit the drivers and make sure you are not breaking them
So this change will not allow to return 0.
This change is help to use platform_get_irq() without this,
val = platform_get_irq();
if (val <= 0)
ret = val ? val : -ENODEV;
Signed-off-by: Arvind Yadav <arvind.yadav.cs@xxxxxxxxx>
with this. I believe at least i2c designware controller on certain
boards has DEFINE_RES_IRQ(0) which will be broken by this patch.
Thanks,
---Thanks.
drivers/base/platform.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index c203fb9..7b3079c 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -127,7 +127,7 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)
irqd_set_trigger_type(irqd, r->flags & IORESOURCE_BITS);
}
- return r ? r->start : -ENXIO;
+ return r && r->start ? r->start : -ENXIO;
#endif
}
EXPORT_SYMBOL_GPL(platform_get_irq);
--
2.7.4