Message ID | 9738e169d83a96f18de417e62b3cf4c20f51f885.1690890774.git.mazziesaccount@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2644539vqg; Tue, 1 Aug 2023 05:51:22 -0700 (PDT) X-Google-Smtp-Source: APBJJlG5+NC1FzIEQEr1PVzUWSFR2Et+X0yAkBsU4I0mdGNwf7NiLN8ftXGNnhyROdvyLQ9rTYyc X-Received: by 2002:a17:907:7851:b0:99b:ff9d:93f2 with SMTP id lb17-20020a170907785100b0099bff9d93f2mr2301620ejc.42.1690894281887; Tue, 01 Aug 2023 05:51:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690894281; cv=none; d=google.com; s=arc-20160816; b=ZTy9E6a3nd4F4gCNuPp9VgM6kAZitTmn4LoUg8e6WjXduAIK0PL3wuCGs0+tt/jv0V ANd0fb58mSmOpB73PlR2VTsSP5V5h10q0EAkbTYg4QV9LP3viddus2E2dao4IGpwCIVv XMJ08SQ85MoDsMT978+dpp6h7LDog3MevEr0AovVeZ+vBbZverRVqfLBDTzsy05KyUTl MxqOS0UiiOxbRUOTgMDEPDWc3wc1Yc22NFBL7mNP01f4GCH012ckwZFo1iUD99Uuic03 REAp4VtV/lQgwFC88+jx35fuhR2n1g1CyyfkmSim8R6hgIP8NHvif8LABDysai+dXNyc MN8A== 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=ADYcjyBt6vQx4AlVs0ouKVJ5yckCOkwBqZsdJ6ZjKOQ=; fh=GDb0NjySuQqK5H0hgVtMH+tMWm+M7a3pd5d6Vy5eKXk=; b=jxdkqH37mzCuSJ4HVXvQH0yjN38eYYeRycw/gsmmKoYxNzoG1l6Iec54yQ6pIyfaJ5 bFNBI+o9BpWpYw/u6eMoAHBZYk4cR2wJj4zit8OqJBEqQF0W34UWW3Usp2lWFWDlOMOL FxQ2tYTgjUBwvgEFOUbgR7QBB1sKGc8jHQ7+9DLC3Cs6O82PCF1lC22KoAvwZfc9tOGD shu/y6PEmkN26yYHHvVOF68gaRWBinPO5xWn5krjSRtCtyzDLj149OPt8n8ZiWw6wy4D oOGFUAbDps6z7L9HtXyQCTY80qHs7FtNFKGXmwrJilMXxMtcNDU+7pHbFedOxIeAyE6l RIzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=mNNs3VPn; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z24-20020a170906815800b0099bd1dc4c3fsi3857386ejw.154.2023.08.01.05.50.58; Tue, 01 Aug 2023 05:51:21 -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=mNNs3VPn; 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 S234162AbjHAMFJ (ORCPT <rfc822;maxi.paulin@gmail.com> + 99 others); Tue, 1 Aug 2023 08:05:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234097AbjHAMEs (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 1 Aug 2023 08:04:48 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E07701FC6; Tue, 1 Aug 2023 05:04:30 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-4fbf09a9139so9019258e87.2; Tue, 01 Aug 2023 05:04:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690891469; x=1691496269; 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=ADYcjyBt6vQx4AlVs0ouKVJ5yckCOkwBqZsdJ6ZjKOQ=; b=mNNs3VPnUFmoXBhLcSCDTGAThPOJlCg40STaqxQT3KJQbAsUU5vq7XDhY/5Wn2HooK 0eLJf+UXlnMF/NN4Ca+PX7/YfOK70km5ZTK7ApccfvC+GMmK6DEuFKUc+ZM4/wKW1pHk Z1CQI/ssPl5x2P3S77aPv+d5kBaiDjl2YW6ULtvXhnXtUBJ4HhPzRpkUmK2JZpRoKQEg vgUNJ1fEBEAbfDilZTKQ7JAaFj25hWDuLmtv3yH8jZ9j1KfNYDT2dqGS9oziBvm5Bjyw ULIQKckJOmZjXWNgq/jMnLg0v7nKja3DsCKqwgDrIdHE38Tm+TZu/PmdHCnbsJe3qKbi QvJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690891469; x=1691496269; 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=ADYcjyBt6vQx4AlVs0ouKVJ5yckCOkwBqZsdJ6ZjKOQ=; b=L1D5/MkyB8vhbWujOdYaknUE7NJYolnKuNGXo53vsejdXuVytkUGfB4nT5YfXJyWFN KKXhBWNCD3XdyYK+X94bHRj+Hz0BXhJ6g1O39pAdeUjGAPVYI+F/n0RiHWZJ6GkscXHW MVcvBUhOpY8b1cIiapNgoFQWNyPQMuxnJZdWWiHmeVKecScjM7sYH39kYYRa657nR4xp 3nHwUgNfKAeE2adgMs6Rvoj0Lli66GOE2eHZgTbZQrdVnz3J9pknx6czbJglEWZIkkpr Z9yoiu0fQE4Q/JGDqEeyKJGdkAPC7nvbzMu/BGKw6GXSEngnc0iKlqLuHsP6NxHB/Mxc 4D8w== X-Gm-Message-State: ABy/qLbl6W3FKTZ4L5eJfz7YTK3lVXiHwqJouKhMvjfADgP5HS+R+d2a p1FpDtORnueNckxrk4pXD7k= X-Received: by 2002:ac2:5bd0:0:b0:4fe:3724:fdb1 with SMTP id u16-20020ac25bd0000000b004fe3724fdb1mr2202695lfn.41.1690891468655; Tue, 01 Aug 2023 05:04:28 -0700 (PDT) Received: from fedora ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id m14-20020a056512014e00b004fe3229e584sm1157059lfo.270.2023.08.01.05.04.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 05:04:27 -0700 (PDT) Date: Tue, 1 Aug 2023 15:04:24 +0300 From: Matti Vaittinen <mazziesaccount@gmail.com> To: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>, Matti Vaittinen <mazziesaccount@gmail.com> Cc: Marcin Wojtas <mw@semihalf.com>, Russell King <linux@armlinux.org.uk>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v8 7/8] net-next: mvpp2: relax return value check for IRQ get Message-ID: <9738e169d83a96f18de417e62b3cf4c20f51f885.1690890774.git.mazziesaccount@gmail.com> References: <cover.1690890774.git.mazziesaccount@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="/sCa28yDRnnrSPo8" Content-Disposition: inline In-Reply-To: <cover.1690890774.git.mazziesaccount@gmail.com> 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773031162853940080 X-GMAIL-MSGID: 1773031162853940080 |
Series |
fix fwnode_irq_get[_byname()] returnvalue
|
|
Commit Message
Matti Vaittinen
Aug. 1, 2023, 12:04 p.m. UTC
fwnode_irq_get[_byname]() were changed to not return 0 anymore.
Drop check for return value 0.
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
---
Revision history:
v5 =>:
- No changes
v4 = v5:
Fix the subject, mb1232 => mvpp2
The patch changing the fwnode_irq_get() got merged during 5.4:
https://lore.kernel.org/all/fb7241d3-d1d1-1c37-919b-488d6d007484@gmail.com/
This is a clean-up as agreed.
---
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Tue, Aug 01, 2023 at 03:04:24PM +0300, Matti Vaittinen wrote: > fwnode_irq_get[_byname]() were changed to not return 0 anymore. > > Drop check for return value 0. > > Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Sorry, but I don't think you've properly considered the effects of your patch. > @@ -5833,7 +5833,7 @@ static int mvpp2_multi_queue_vectors_init(struct mvpp2_port *port, > v->irq = of_irq_get_byname(port_node, irqname); > else > v->irq = fwnode_irq_get(port->fwnode, i); > - if (v->irq <= 0) { > + if (v->irq < 0) { You're making this change based on the assumption that fwnode_irq_get() has changed its return values, but I really don't think you've looked at the code and considered the return value behaviour of the DT function above. Reading it's documentation, it states that of_irq_get_byname() may return 0 on IRQ mapping failure. So, by making this change, you are allowing IRQ mapping failure in the DT path to succeed rather than fail. > ret = -EINVAL; > goto err; > } > @@ -6764,7 +6764,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, > err = -EPROBE_DEFER; > goto err_deinit_qvecs; > } > - if (port->port_irq <= 0) > + if (port->port_irq < 0) Exactly the same problem here, but... > /* the link irq is optional */ > port->port_irq = 0; this is less critical... but still wrong. So, given that this patch is basically incorrect... NAK.
On 8/1/23 15:31, Russell King (Oracle) wrote: > On Tue, Aug 01, 2023 at 03:04:24PM +0300, Matti Vaittinen wrote: >> fwnode_irq_get[_byname]() were changed to not return 0 anymore. >> >> Drop check for return value 0. >> >> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> > > Sorry, but I don't think you've properly considered the effects of your > patch. Don't be sorry. > >> @@ -5833,7 +5833,7 @@ static int mvpp2_multi_queue_vectors_init(struct mvpp2_port *port, >> v->irq = of_irq_get_byname(port_node, irqname); >> else >> v->irq = fwnode_irq_get(port->fwnode, i); >> - if (v->irq <= 0) { >> + if (v->irq < 0) { > > You're making this change based on the assumption that fwnode_irq_get() > has changed its return values, but I really don't think you've looked > at the code and considered the return value behaviour of the DT function > above. Reading it's documentation, it states that of_irq_get_byname() > may return 0 on IRQ mapping failure. You're correct. Thanks for spotting this! Seems like I really overlooked the behaviour of the of_irq_get_byname(). > So, by making this change, you are allowing IRQ mapping failure in the > DT path to succeed rather than fail. > >> ret = -EINVAL; >> goto err; >> } >> @@ -6764,7 +6764,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, >> err = -EPROBE_DEFER; >> goto err_deinit_qvecs; >> } >> - if (port->port_irq <= 0) >> + if (port->port_irq < 0) > > Exactly the same problem here, but... > >> /* the link irq is optional */ >> port->port_irq = 0; > > this is less critical... but still wrong. > > So, given that this patch is basically incorrect... > > NAK. >
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index 1fec84b4c068..2632ffe91ca5 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -5833,7 +5833,7 @@ static int mvpp2_multi_queue_vectors_init(struct mvpp2_port *port, v->irq = of_irq_get_byname(port_node, irqname); else v->irq = fwnode_irq_get(port->fwnode, i); - if (v->irq <= 0) { + if (v->irq < 0) { ret = -EINVAL; goto err; } @@ -6764,7 +6764,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, err = -EPROBE_DEFER; goto err_deinit_qvecs; } - if (port->port_irq <= 0) + if (port->port_irq < 0) /* the link irq is optional */ port->port_irq = 0;