Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752806AbdLESML (ORCPT ); Tue, 5 Dec 2017 13:12:11 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:34184 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752179AbdLESMK (ORCPT ); Tue, 5 Dec 2017 13:12:10 -0500 X-Google-Smtp-Source: AGs4zMYk0VzSoDzdzRKWVZXbgF1uFJmbY4KuRMyB6jO+vtkipoHfpkwy1ASIjbTl+Ne6SYuCfoypWw== From: Arvind Yadav To: gregkh@linuxfoundation.org, davem@davemloft.net, dmitry.torokhov@gmail.com, linus.walleij@linaro.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] driver-core: platform: Avoid to return IRQ 0 in platform_get_irq() Date: Tue, 5 Dec 2017 23:41:52 +0530 Message-Id: X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 821 Lines: 29 Function platform_get_irq() can return 0. Which means NO_IRQ. 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 --- 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