platform: remove useless if-branch in __platform_get_irq_byname()
authorSoha Jin <soha@lohu.info>
Fri, 11 Nov 2022 09:45:42 +0000 (17:45 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Jan 2023 18:12:48 +0000 (19:12 +0100)
When CONFIG_OF_IRQ is not enabled, there will be a stub method that always
returns 0 when getting IRQ. Thus, the if-branch can be removed safely.

Signed-off-by: Soha Jin <soha@lohu.info>
Link: https://lore.kernel.org/r/20221111094542.270540-1-soha@lohu.info
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/platform.c

index d6690d7..b10a130 100644 (file)
@@ -441,11 +441,9 @@ static int __platform_get_irq_byname(struct platform_device *dev,
        struct resource *r;
        int ret;
 
-       if (!dev->dev.of_node || IS_ENABLED(CONFIG_OF_IRQ)) {
-               ret = fwnode_irq_get_byname(dev_fwnode(&dev->dev), name);
-               if (ret > 0 || ret == -EPROBE_DEFER)
-                       return ret;
-       }
+       ret = fwnode_irq_get_byname(dev_fwnode(&dev->dev), name);
+       if (ret > 0 || ret == -EPROBE_DEFER)
+               return ret;
 
        r = platform_get_resource_byname(dev, IORESOURCE_IRQ, name);
        if (r) {