From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA79BC4CECE for ; Fri, 13 Mar 2020 21:06:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 83BEB2074F for ; Fri, 13 Mar 2020 21:06:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726895AbgCMVGP (ORCPT ); Fri, 13 Mar 2020 17:06:15 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:48041 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726543AbgCMVGO (ORCPT ); Fri, 13 Mar 2020 17:06:14 -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 1jCrVH-0003IC-Bk; Fri, 13 Mar 2020 22:05:59 +0100 Received: by nanos.tec.linutronix.de (Postfix, from userid 1000) id 7674A100C8D; Fri, 13 Mar 2020 22:05:58 +0100 (CET) From: Thomas Gleixner To: Bjorn Helgaas , Marc Gonzalez Cc: 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: <20200312141102.GA93224@google.com> References: <20200312141102.GA93224@google.com> Date: Fri, 13 Mar 2020 22:05:58 +0100 Message-ID: <871rpwhsnd.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-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Bjorn, Bjorn Helgaas writes: > On Thu, Mar 12, 2020 at 10:53:06AM +0100, Marc Gonzalez wrote: >> Last time around, my understanding was that, going forward, >> the best solution was: >> >> virq = platform_get_irq(...) >> if (virq <= 0) >> return virq ? : -ENODEV; >> >> i.e. map 0 to -ENODEV, pass other errors as-is, remove the dev_err >> >> @Bjorn/Lorenzo did you have a change of heart? > > Yes. In 10006651 (Oct 20, 2017), I thought: > > irq = platform_get_irq(pdev, 0); > if (irq <= 0) > return -ENODEV; > > was fine. In 11066455 (Aug 7, 2019), I said I thought I was wrong and > that: > > platform_get_irq() is a generic interface and we have to be able to > interpret return values consistently. The overwhelming consensus > among platform_get_irq() callers is to treat "irq < 0" as an error, > and I think we should follow suit. > ... > I think the best pattern is: > > irq = platform_get_irq(pdev, i); > if (irq < 0) > return irq; Careful. 0 is not a valid interrupt. Thanks, tglx