Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2167750ybh; Fri, 13 Mar 2020 14:08:04 -0700 (PDT) X-Google-Smtp-Source: ADFU+vszzMYsJWfc65YADePReb9WONqDlbU6iDq8rtVouVxhIyDP1GfLLxK4FJzRtgJQHFis6s4/ X-Received: by 2002:a05:6808:244:: with SMTP id m4mr8694835oie.125.1584133684351; Fri, 13 Mar 2020 14:08:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584133684; cv=none; d=google.com; s=arc-20160816; b=HPmhUvc1nrcQwSt0J7SrwPC+5Zzf8cPDINw4wVBFsLLsyjYDV6XbWhxCx+w+MQOSYb +LolQEt4jTTrcTJ6AtblOYMhXdI4iRRG84k1x+V3EX8RuAppVt51lkQmtv7wM88pXWQK +nA8BoLQwMCEAYXEqAE2A+p7GWfAgpzIxjixUkY+OZ6rpkl5geNS/RoPTy+RdlyTFJ9h AojgEXMzaLOCZRPyN8iPyf3R7ZZGWe3Zf30vzmZB947vWVYC8MZJdOaAYakDWOBFURi6 WTn4tadVFKqbpbojB6LyspperMoP7clvyY1VORdIefH3ehcYBtzjNAJ5pRYmBFlfxwkl pj/g== 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=38fPWfDIn/6xPzxGIa7RGxZFOi9xVGpEkq0zrw3fors=; b=FG6Odb90nsAj5DWosaT0Pj19YGjHSKdrjBEW5NH74x6/ps2QVkv9ealBJMpBiVcENN UplmhO0DY8jnv5UOIfKGAcydLLAKkYzaweLnl45KKZuezjIyvcPwNGOTTiR0WapRkeuN fc7vrwuYIRGRlqg6+ekueR6owoMZLF3Bs03p/nStYo2kN/06ArkhFHHbc/3Dczt1uasf dCxn2wcbLVUFyFxC9+z0jX7NYI5om7EU3NLSbUWpoH4mvxaA30Pik0Y5d7X0d+WGhdxR WtF2wn66EkFI5Hp01Artv6C8RLLLlvjyz4TAmFiIOnUfeLbhZBboULA3/ZYXLr/aUNoq Kx8Q== 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 u24si5267286otk.287.2020.03.13.14.07.22; Fri, 13 Mar 2020 14:08:04 -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 S1727210AbgCMVGP (ORCPT + 99 others); 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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