Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp261528rwd; Tue, 16 May 2023 00:14:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7s/TP9mf+4p2FV5gJjrMHhI5Xegh6b9sZCz6P22L/eaOnTa1UmdsSp3xkiAbsQoG7dQBfQ X-Received: by 2002:a17:902:ec8c:b0:1ac:3d1c:83c9 with SMTP id x12-20020a170902ec8c00b001ac3d1c83c9mr49853296plg.13.1684221259364; Tue, 16 May 2023 00:14:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684221259; cv=none; d=google.com; s=arc-20160816; b=GCT7SJk3y5VTm3gI5JgqCMBDcte1ADIKuicMRnHQEN5nwp0nFbCJ97qtXzV+jiEjTD XcoPlQLziSzjP+ELwehKdX5bLaKSqn9vDaU+Y22P0hfzHTLrP/j5qjPRqVa26nXeJg0v ZlnZcSW7JpAJAXqLAob1WWwFP7FOC+8Qei3+CiKGYYx6Sx4zopAaAQvpTuJsn+HYaBKu jcnWUSHDxU5gvyiLUupE6g6rZxx8pglSUcQh7vqbvctWWs2GKgzMdM+a5p3jbh9uxjao 8pSUYPMBWhwI5q6S45dNqHU4CaAmYRMaw+fvegKLl0FLec6sRmvt8ZrVFiogta3IaFbZ lSWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nIQsLaHssKkl6pMh4izl/5JY75K4E7vPiAyWjhDInUQ=; b=N/uaKoeMAnHcelvqCNGYI9g1U9/td5LCrsSZDpxI8jF6wJIl67OpvzGS6f10LJ6J4q XCsxUN6MZDK4vrcmgSpUOgUtalkSpEVJe326B5GPUDtjvMwPxntG+psRMDRYMfX1Gdwy Jll8cqLNyK+/Ww0Tr2bkita4oIqBiJFQVyeHsW77Fo4N17eUlBUfv5Og2M1JNmec6Lrk h5SLintWY9SoCRzG70adFRXz5rRUCkAW5OF2mxIkMrUs5BKScFCiz26OWB/5idc3eqF3 Aj31Ekvp56lPmSIwgKTLFtzJnRCITAZXQg1dcq8TtlgKC6Kwf/vSge92Kn8r7LHIsiqA sqnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=kVyZEfq6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m5-20020a170902db0500b001a961bfe4b7si19654253plx.362.2023.05.16.00.14.04; Tue, 16 May 2023 00:14:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=kVyZEfq6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230262AbjEPHMf (ORCPT + 99 others); Tue, 16 May 2023 03:12:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230111AbjEPHMd (ORCPT ); Tue, 16 May 2023 03:12:33 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE1D935AD; Tue, 16 May 2023 00:12:28 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-4f1fe1208a4so12906237e87.2; Tue, 16 May 2023 00:12:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684221147; x=1686813147; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=nIQsLaHssKkl6pMh4izl/5JY75K4E7vPiAyWjhDInUQ=; b=kVyZEfq6Q5jbhZ2IenNtfFHWP9ROgSqyZjUzcQyz17v9aApeHKzTAiCKMRPPt8Cz+U sO1aikJBvml29mD0dna23tcxwWy8iHg0X56CibVfXurzDAHBQtvy3SPRBkQD9BUmzSRK UWGib1T+IESAZ5lTgswFoUp48FFp3s7chTAeep0cf2bZw5QodQ3QQVMiATwuiLdfSeqx 8bvDST1CyN0vGgJFpxQNPn9RUEOeyQGRQBxtrynZzueM9HkG9B5sPKXdhwlOqikCnhmx j3hmIizOF/ix81U+k34v3TwnOPw5iu3mcbo/QwSHusrF9rI9a7AGDinMrTOB9bxl6DxC yjfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684221147; x=1686813147; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=nIQsLaHssKkl6pMh4izl/5JY75K4E7vPiAyWjhDInUQ=; b=VqqZT1yZgoVMCjRDxsTnz/cs0Us6ZIyk3E728W8wr0Q93hrTZwVmYndt1WKwmNpM0Z x60bjYm3kDUla42gGLoFqogqR1VRi+I66X4JUpHgJlS5Jxe3r1phbs/lBPkvvWsqCyb/ +lYiqRE/XGxFdEQrb2NfmvgLi7GiyiTd2BSavBB/uUNLAiSPSOtgKaUy4JK8kzSSyh+2 q8pbGnTTVK6YF/TL4//LpcxgZS42f3dZQctbuAxb5SEFckhED2w04DputPYd59ZfB5xX SVSuLvvvi2X1KdrZh9fDp6qq7cb8H6nt+KMoc9Uy6iETbitbztcsI2X1Et7MASTz/6N/ RyMg== X-Gm-Message-State: AC+VfDysQ7KlMsmFR/Y0grRkGP/UWVU0NdiI6BMHLDxcuQMzMJJSwZRQ Dk9MOzWOGY03VwbhahS3hjU= X-Received: by 2002:ac2:48a1:0:b0:4f3:8823:ebe9 with SMTP id u1-20020ac248a1000000b004f38823ebe9mr715145lfg.22.1684221146822; Tue, 16 May 2023 00:12:26 -0700 (PDT) Received: from fedora (62-78-225-252.bb.dnainternet.fi. [62.78.225.252]) by smtp.gmail.com with ESMTPSA id g14-20020a19ee0e000000b004f25c29f64esm2700143lfb.176.2023.05.16.00.12.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 00:12:26 -0700 (PDT) Date: Tue, 16 May 2023 10:12:21 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J. Wysocki" , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Andreas Klinger , Marcin Wojtas , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan =?iso-8859-1?Q?Neusch=E4fer?= , Linus Walleij , Paul Cercueil , Wolfram Sang , Akhil R , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, netdev@vger.kernel.org, openbmc@lists.ozlabs.org, linux-gpio@vger.kernel.org, linux-mips@vger.kernel.org Subject: [PATCH v4 1/7] drivers: fwnode: fix fwnode_irq_get[_byname]() Message-ID: <339cc23ccae4580d5551cc2b6b9b4afdde48f25e.1684220962.git.mazziesaccount@gmail.com> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="fzqZWu+mtDdK0Jc5" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --fzqZWu+mtDdK0Jc5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable The fwnode_irq_get() and the fwnode_irq_get_byname() return 0 upon device-tree IRQ mapping failure. This is contradicting the fwnode_irq_get_byname() function documentation and can potentially be a source of errors like: int probe(...) { ... irq =3D fwnode_irq_get_byname(); if (irq <=3D 0) return irq; ... } Here we do correctly check the return value from fwnode_irq_get_byname() but the driver probe will now return success. (There was already one such user in-tree). Change the fwnode_irq_get_byname() to work as documented and make also the fwnode_irq_get() follow same common convention returning a negative errno upon failure. Fixes: ca0acb511c21 ("device property: Add fwnode_irq_get_byname") Suggested-by: Sakari Ailus Suggested-by: Jonathan Cameron Signed-off-by: Matti Vaittinen --- I dropped the existing reviewed-by tags because change to fwnode_irq_get() was added. Revision history: v3 =3D> v4: - Change also the fwnode_irq_get() --- drivers/base/property.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/base/property.c b/drivers/base/property.c index f6117ec9805c..8c40abed7852 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -987,12 +987,18 @@ EXPORT_SYMBOL(fwnode_iomap); * @fwnode: Pointer to the firmware node * @index: Zero-based index of the IRQ * - * Return: Linux IRQ number on success. Other values are determined - * according to acpi_irq_get() or of_irq_get() operation. + * Return: Linux IRQ number on success. Negative errno on failure. */ int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index) { - return fwnode_call_int_op(fwnode, irq_get, index); + int ret; + + ret =3D fwnode_call_int_op(fwnode, irq_get, index); + /* We treat mapping errors as invalid case */ + if (ret =3D=3D 0) + return -EINVAL; + + return ret; } EXPORT_SYMBOL(fwnode_irq_get); =20 --=20 2.40.1 --=20 Matti Vaittinen, Linux device drivers ROHM Semiconductors, Finland SWDC Kiviharjunlenkki 1E 90220 OULU FINLAND ~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~ Simon says - in Latin please. ~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~ Thanks to Simon Glass for the translation =3D]=20 --fzqZWu+mtDdK0Jc5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmRjLNUACgkQeFA3/03a ocXWBwgAoTg2gyrbSegZNG72m8qgJFB4ijYPCs2RyJCcx8WVs0X8/B10OZjD3x3H B6+4ZYtlNLDhwBkP3H/p1F6P0g7uhRVPNR3HeLlr6VTXXnO4o2KxkbeOVIEcidf0 eR0hR6PtI7qKbYZvqKLOJetWefDRVlaARk8xy6G0Q+6VNShxm+TDBzJ1SklJnrSw sIeyeK41XqMbQ2PFZzWW1REd0ai0wyYCKTQj3h/oawsZDS0AT0JxIAlsW1W6RAfo F/4Z2f1fsrHX2+/7AX3h7YWzUNVgjaPIHf1qV+GlulWzUNY81k6PAdH9b+rbHnP/ wAxUsuKyRch+fUgLBJWNfIk670GzUg== =9vGc -----END PGP SIGNATURE----- --fzqZWu+mtDdK0Jc5--