Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751878AbdLBPaL (ORCPT ); Sat, 2 Dec 2017 10:30:11 -0500 Received: from mail-io0-f193.google.com ([209.85.223.193]:39542 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751749AbdLBPaJ (ORCPT ); Sat, 2 Dec 2017 10:30:09 -0500 X-Google-Smtp-Source: AGs4zMYpf1snL0tOF4ZB7DOQrGX02w1WwN/wvCwK6GH4pRBK17Pb2275SS9F9HCTURFvsyvl+y7Ovn898Ew4265IxcE= MIME-Version: 1.0 In-Reply-To: References: From: Linus Walleij Date: Sat, 2 Dec 2017 16:30:08 +0100 Message-ID: Subject: Re: [PATCH] gpio: ftgpio010: Fix platform_get_irq's error checking To: Arvind Yadav Cc: "linux-kernel@vger.kernel.org" , linux-gpio@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 774 Lines: 32 Hi Arvind, thanks for the patch! On Thu, Nov 30, 2017 at 3:12 PM, Arvind Yadav wrote: > The platform_get_irq() function returns negative if an error occurs. > zero or positive number on success. platform_get_irq() error checking > for zero is not correct. > > Signed-off-by: Arvind Yadav (...) > irq = platform_get_irq(pdev, 0); > - if (!irq) > - return -EINVAL; > + if (irq < 0) > + return irq; This is wrong. For an in-depth explanation why irq 0 in not valid, see: https://lwn.net/Articles/470820/ It should be: if (irq <= 0) return irq ? irq : -EINVAL; Please update and resubmit. If you have more patches like this, correct them too. Yours, Linus Walleij