Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4236763pxu; Mon, 21 Dec 2020 07:31:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJx62DcvelQ9nT6YnIYHLSlRhsGtgMPmxfxZv4iq4bfOxkJZgjTpk5vYQKQftooabVuQrRQY X-Received: by 2002:a17:906:9acc:: with SMTP id ah12mr15466841ejc.386.1608564675653; Mon, 21 Dec 2020 07:31:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608564675; cv=none; d=google.com; s=arc-20160816; b=tyJZNZA0u4/+bVga+G/rwKcETqS2l9dSGEYyuKlAyfRSKWzujfmvBzMSmdvbh2qPmV Fo542oeNM7fSoFH68QYZ09L0+pL5aJ/qkAvbNm+ZI1bmGvyUPBrnLM4LuSd3iK/4zXCH 8s5Cqj9jDc15IyiJiFd9MCxK/N6tPFtZPyc2K9dN/Pxiz/kpgr1h66nNdnPIscxU7rYY GjO0bQGwZubgzCOtlDlfGSE3LqBe7UxPY9fBmN3qzuHN5XpiKshsCbx4k8cXaKeURlww mhD7aRwtbf2OJwUGfnyG32EkMq+q1l3KRV72Jc7yDL1kaIFYArVKD3OsOT44z/qav5ql gfMg== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=M0QUNP8fM1BxV+Y9AZr8x5u889gUca4K9VNWeJ2gZYE=; b=unTu4sXwPWDXN1HpNHAwT7VEgSjejq0OKlxCTgCE2rEI7PO3FOA6zGUKfQ2znYLpLX CKNMCS+uIrPKIPj8MPGXBbBzuxkA56AXhA+aoqRrzGWD8v4X9VmaR2G2lXxaXgwoAehp riquabRN9av3z771JBKqw4uzJ6vKn9fnEFnA4v3EzKY3RWic1bdy8w5SFMpmggIgYr8v JWniyHnxHpf9OIAWRkf95vZqd2Q63j6MrNioxBbhb6mhd1Y9/Vpycd3MASUO2ETO3lt7 NjtSoadUcl4KIDAaZpM9chGb3MUrDqF1XNVD/N4xd73eOGe8gdfoJ3rXykujmxp+2yTB cWFA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l20si11387790edw.0.2020.12.21.07.30.52; Mon, 21 Dec 2020 07:31:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726408AbgLUP13 (ORCPT + 99 others); Mon, 21 Dec 2020 10:27:29 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:35716 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725497AbgLUP12 (ORCPT ); Mon, 21 Dec 2020 10:27:28 -0500 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1krN5B-00D9ko-LI; Mon, 21 Dec 2020 16:26:45 +0100 Date: Mon, 21 Dec 2020 16:26:45 +0100 From: Andrew Lunn To: Masahiro Yamada Cc: "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Miguel Ojeda , Arnd Bergmann , Heiner Kallweit Subject: Re: [PATCH] net: lantiq_etop: check the result of request_irq() Message-ID: <20201221152645.GH3026679@lunn.ch> References: <20201221054323.247483-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20201221054323.247483-1-masahiroy@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 21, 2020 at 02:43:23PM +0900, Masahiro Yamada wrote: > The declaration of request_irq() in is marked as > __must_check. > > Without the return value check, I see the following warnings: > > drivers/net/ethernet/lantiq_etop.c: In function 'ltq_etop_hw_init': > drivers/net/ethernet/lantiq_etop.c:273:4: warning: ignoring return value of 'request_irq', declared with attribute warn_unused_result [-Wunused-result] > ? 273 | ? ?request_irq(irq, ltq_etop_dma_irq, 0, "etop_tx", priv); > ? ? ? | ? ?^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/net/ethernet/lantiq_etop.c:281:4: warning: ignoring return value of 'request_irq', declared with attribute warn_unused_result [-Wunused-result] > ? 281 | ? ?request_irq(irq, ltq_etop_dma_irq, 0, "etop_rx", priv); > ? ? ? | ? ?^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Reported-by: Miguel Ojeda > Signed-off-by: Masahiro Yamada > --- > > drivers/net/ethernet/lantiq_etop.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c > index 2d0c52f7106b..960494f9752b 100644 > --- a/drivers/net/ethernet/lantiq_etop.c > +++ b/drivers/net/ethernet/lantiq_etop.c > @@ -264,13 +264,18 @@ ltq_etop_hw_init(struct net_device *dev) > for (i = 0; i < MAX_DMA_CHAN; i++) { > int irq = LTQ_DMA_CH0_INT + i; > struct ltq_etop_chan *ch = &priv->ch[i]; > + int ret; > > ch->idx = ch->dma.nr = i; > ch->dma.dev = &priv->pdev->dev; > > if (IS_TX(i)) { > ltq_dma_alloc_tx(&ch->dma); > - request_irq(irq, ltq_etop_dma_irq, 0, "etop_tx", priv); > + ret = request_irq(irq, ltq_etop_dma_irq, 0, "etop_tx", priv); > + if (ret) { > + netdev_err(dev, "failed to request irq\n"); > + return ret; You need to cleanup what ltq_dma_alloc_tx() did. > + } > } else if (IS_RX(i)) { > ltq_dma_alloc_rx(&ch->dma); > for (ch->dma.desc = 0; ch->dma.desc < LTQ_DESC_NUM; > @@ -278,7 +283,11 @@ ltq_etop_hw_init(struct net_device *dev) > if (ltq_etop_alloc_skb(ch)) > return -ENOMEM; > ch->dma.desc = 0; > - request_irq(irq, ltq_etop_dma_irq, 0, "etop_rx", priv); > + ret = request_irq(irq, ltq_etop_dma_irq, 0, "etop_rx", priv); > + if (ret) { > + netdev_err(dev, "failed to request irq\n"); > + return ret; And here you need to cleanup ltq_dma_alloc_rx(). Andrew