Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp402772ybg; Thu, 19 Mar 2020 01:49:33 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv1rjjndjXjTESUvXaRzCbH6/SoNdXuS1cgecgbyeSMjF5CACWzJIBzA3Y6ihJwIhNcBGZ6 X-Received: by 2002:a05:6830:19ec:: with SMTP id t12mr1347841ott.24.1584607772968; Thu, 19 Mar 2020 01:49:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584607772; cv=none; d=google.com; s=arc-20160816; b=FLLXERmkRknF8ZZoAvHhyuXiem5Ltm11Wg+q8AA62ofHYi/7i9Owwg4zh2y26F5Adq dzeJF6Ab5S1U8THp4b83+ZbGx8Bj2KociUO5ym/s88pEX5bvEwZ5aETSJn2hvmmAkO1N /yrNW3x5beu3J3n4HkGen1CWndSmhJMczJesfI0Z4bDMLMOxolainWmBWj9tswsPhMgl WmYN8+uomS7UY/2iF2NIKU9J4R2LaoGImX8H/J/h/bMHQPz2w0j8+tB/Tnayh3O7j+/n fQSrkbL4XbOJEe0Bl6bFSEVbw/0h/LuHdnCnjkdZMlwPV1owpXeQo1UE8Qqw4OMcsHh1 swoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=YofeAChHIw24Z1Pxp+rON65fGp+t4J0GRCtaDB88vDk=; b=RGVVfUhDGgiSHLIKo3BHLiX8GmofreeoXseDnwUm5sy8kOlnrCJqSr9/br42ZyzLmW Vf+Jpm91/uQy5WEcIzZIcuww/8NEWAUdV+L7/A0EONtZYD0h5hRh0iWCfbSrFVzQUKhZ /7mC5p/4907XZXYalXoTegZMQsXJ85sRdr4YEpI+3npkKqPu5tRsEkaWGtELIQ3ak9Gm ulF8jcG0Z5OHEMb/SLmEZjakab1sNSbx7USmFAW1wdYk8TwYtXUVK+yjjoGtLTsw4JmS VNSX51uqyH/Pt4F3x3KABlBuHFFXtVooICKT8WKid6Zk4ZLR2CSraCo6QA6W6Pf2Mobm kw2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n14si915561otq.13.2020.03.19.01.49.20; Thu, 19 Mar 2020 01:49:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727298AbgCSIsU (ORCPT + 99 others); Thu, 19 Mar 2020 04:48:20 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:59784 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727053AbgCSIsB (ORCPT ); Thu, 19 Mar 2020 04:48:01 -0400 Received: from p5de0bf0b.dip0.t-ipconnect.de ([93.224.191.11] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jEqqD-0002xp-G4; Thu, 19 Mar 2020 09:47:49 +0100 Received: by nanos.tec.linutronix.de (Postfix, from userid 1000) id AB625103088; Thu, 19 Mar 2020 09:47:47 +0100 (CET) From: Thomas Gleixner To: Bjorn Helgaas Cc: Marc Gonzalez , Aman Sharma , Lorenzo Pieralisi , Thomas Petazzoni , Andrew Murray , Linus Walleij , Ryder Lee , Karthikeyan Mitran , Hou Zhiqiang , Mans Rullgard , Matthias Brugger , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, Marc Zyngier Subject: Re: [PATCH 4/5] pci: handled return value of platform_get_irq correctly In-Reply-To: <20200318222238.GA247500@google.com> References: <20200318222238.GA247500@google.com> Date: Thu, 19 Mar 2020 09:47:47 +0100 Message-ID: <877dzgennw.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Bjorn Helgaas writes: > On Wed, Mar 18, 2020 at 02:42:48PM +0100, Thomas Gleixner wrote: >> Bjorn Helgaas writes: >> > On Fri, Mar 13, 2020 at 04:56:42PM -0500, Bjorn Helgaas wrote: >> >> On Fri, Mar 13, 2020 at 10:05:58PM +0100, Thomas Gleixner wrote: >> >> > > I think the best pattern is: >> >> > > >> >> > > irq = platform_get_irq(pdev, i); >> >> > > if (irq < 0) >> >> > > return irq; >> >> > >> >> > Careful. 0 is not a valid interrupt. >> >> >> >> Should callers of platform_get_irq() check for a 0 return value? >> >> About 900 of them do not. >> >> I don't know what I was looking at. >> >> platform_get_irq() does the right thing already, so checking for irq < 0 >> is sufficient. >> >> Sorry for the confusion! > > Thanks, I was indeed confused! Maybe we could reduce future confusion > by strengthening the comments slightly, e.g., > > - * Return: IRQ number on success, negative error number on failure. > + * Return: non-zero IRQ number on success, negative error number on failure. > > I don't want to push my luck, but it's pretty hard to prove that > platform_get_irq() never returns 0. What would you think of something > like the following? No objections from my side.