[net,1/2] net: tehuti: Fix a missing pci_disable_msi() in the error handling path of bdx_probe()
Message ID | 011588ecfd6689e27237f96213acdb7a3543f981.1709066709.git.christophe.jaillet@wanadoo.fr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-83991-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2958346dyb; Tue, 27 Feb 2024 12:52:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV+SabEC3R+oZRILyx95SKiS6XihQxn+pFt6WSJL1J/iK1UpYi9WgvC8xQmZtoYrvBTyjSZeziGGnT+aW98UzYg77+CwA== X-Google-Smtp-Source: AGHT+IGN5SikCoBJNo9RMFAU6MGTECk3ch95aHc9e5vPK0F0LYlUCc7o8sYCuW0uKIpbjcTuaDNg X-Received: by 2002:a17:906:8419:b0:a43:5d34:a8dc with SMTP id n25-20020a170906841900b00a435d34a8dcmr3530488ejx.5.1709067172843; Tue, 27 Feb 2024 12:52:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709067172; cv=pass; d=google.com; s=arc-20160816; b=qUjOzcAap/XIbJOeh9Ude7qNLp2HUEMUJYbX3NtTlRG0iuzEk0joj90Yd7Nu5hr3qL KGfe+3nx4T51D4tYoLzfoS6R+rtaK50Pzs+pyA6LB4ZKx14dOrwhW10afzG/CpDwUdua 7P+BTd9Es3rgD9cgUGa6oZvh5lCvoWAgLhHJRFrNM0WWxwOUlkJnAq4Vb1uNftNcEl97 N1GEPXt/IvKP7zAGUw3q9CDLF4+4bHYmEnjoimnShIuDZB9BeWTqT4TsQjCvrFcqE7Sf b9vTy92UEUy052qjpTyD7xmtObAp09qjm2k5dqRo1m41t2fp0+rMdHjCAON/MxBMKt4R dPXw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=+f4AbVJbx28S60iHUgdJzBPh+asTj/MtBzhNY4Ac8Mw=; fh=fy3WxJgzAvVIUuIAKsA9SqNT5iC1mOpKhMV0nRoHjUg=; b=xb1LpLX88f9VrnwT2h5o8c7sA59x2S2BpuvoKZ8EjkTyUdSVBedYttsArdRcE9iwNR 0dc7KUmEka0e7ImMValb5gUPAp3AhtAC8iGTbLqSQMTOM8572wg2i1EkH5neWtsMsZcy mq2fhTBoGHMo2DRRQiJ2UGPu7pcB1RNFNNnmMBcgTYY7RONRNndPQrn1qzjpQf84KcE3 kf9/VMrNftWd18LyJZtC84G2weO3Y032boWU+8UO08CkYafDHePhx+IPcuMbD20j5JSa i0ix/Nd2pd+04xlp18pTf0GCmQA4XeZS8s1mN1qZ6yMTe7F92ddwJMqZcA9H616z+s+F u1uA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=gcWC20Sh; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-83991-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83991-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id lu22-20020a170906fad600b00a3eaa9cefe2si1005507ejb.577.2024.02.27.12.52.52 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 12:52:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83991-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=gcWC20Sh; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-83991-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83991-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E33E81F21E5C for <ouuuleilei@gmail.com>; Tue, 27 Feb 2024 20:52:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A9726153518; Tue, 27 Feb 2024 20:51:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="gcWC20Sh" Received: from smtp.smtpout.orange.fr (smtp-27.smtpout.orange.fr [80.12.242.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 128D114EFFF for <linux-kernel@vger.kernel.org>; Tue, 27 Feb 2024 20:51:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.27 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709067077; cv=none; b=fZhXq/RzsWMBXhw8R4oDt1bbxfzP5oGPd1XMRZfiC1g1H5gNvZnHcUzAm6cVCYY36MWmuEs2cZ648XSf8DfcieIoyRYTR6qoMhEeGb0GFpPSJ2ALABTIlBa+muw23t7goBg5UCuXza3RSLJTTf2z8Nva0LSqZGecm+BULS38jvw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709067077; c=relaxed/simple; bh=8UZtwuLFt1gMui9a2Im7UgO6iF/un1cR2TCSHsPBa04=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Dd7CqpEbgo3f4ccu/XN3qYvCK4H6VrD7ApOFhh6qVRKMdWDuLpT7DOUDAQo1F6MiKVzVw4gIqQJZTCblUGyMU5xP8N0Bh92I0u8oVoF9QqCmCTgtP1oN17PkWK+ZDGKfgpHf3Afi14KPmDLo+5kJLgSboEoVWov2an1pMQomf1M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=gcWC20Sh; arc=none smtp.client-ip=80.12.242.27 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Received: from fedora.home ([92.140.202.140]) by smtp.orange.fr with ESMTPA id f4PjrRU7nxsbMf4PwrnVkS; Tue, 27 Feb 2024 21:51:12 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1709067072; bh=+f4AbVJbx28S60iHUgdJzBPh+asTj/MtBzhNY4Ac8Mw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gcWC20ShNiGpb3YLDEDliWcB/JrBjMeZvLiuX67SiQq7eqjFdQUY2LHnAXwPqJNJY yWw2f7Uqpygzy9cv/62d5bB2+6RsO7P4lOL/IVjXvA6NI26jU5+9grghCbYdyp1OG4 jXp60QFwXgvk5vHlKq3j0r2bM5r+tY5/cuZ6Ng2EtGwPYYgA98JHMe927Qazz6XHXC opadKaVCYDe1tWN0/ZXKb2tMl+c6hRZCjdK9EKk17II29QnrlvJnmXESVkyMW2Gp5T 3cSWhIEHQZ33KHj7nh2o+UApC2K1iywSVoy+JVNjFJLD7wKtcMnhMSj6ozH0aGp086 MCm/cIjUeRNZw== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 27 Feb 2024 21:51:12 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> To: andy@greyhouse.net, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET <christophe.jaillet@wanadoo.fr> Subject: [PATCH net 1/2] net: tehuti: Fix a missing pci_disable_msi() in the error handling path of bdx_probe() Date: Tue, 27 Feb 2024 21:50:55 +0100 Message-ID: <011588ecfd6689e27237f96213acdb7a3543f981.1709066709.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.43.2 In-Reply-To: <cover.1709066709.git.christophe.jaillet@wanadoo.fr> References: <cover.1709066709.git.christophe.jaillet@wanadoo.fr> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792086819607571188 X-GMAIL-MSGID: 1792086819607571188 |
Series |
net: tehuti: Fix some error handling paths in bdx_probe()
|
|
Commit Message
Christophe JAILLET
Feb. 27, 2024, 8:50 p.m. UTC
If an error occurs after a successful call to pci_enable_msi(),
pci_disable_msi() should be called as already done in the remove function.
Add a new label and the missing pci_disable_msi() call.
Fixes: 1a348ccc1047 ("[NET]: Add Tehuti network driver.")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only.
---
drivers/net/ethernet/tehuti/tehuti.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
Comments
Tue, Feb 27, 2024 at 09:50:55PM CET, christophe.jaillet@wanadoo.fr wrote: >If an error occurs after a successful call to pci_enable_msi(), >pci_disable_msi() should be called as already done in the remove function. > >Add a new label and the missing pci_disable_msi() call. > >Fixes: 1a348ccc1047 ("[NET]: Add Tehuti network driver.") >Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> >--- >Compile tested only. >--- > drivers/net/ethernet/tehuti/tehuti.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > >diff --git a/drivers/net/ethernet/tehuti/tehuti.c b/drivers/net/ethernet/tehuti/tehuti.c >index ca409515ead5..938a5caf5a3b 100644 >--- a/drivers/net/ethernet/tehuti/tehuti.c >+++ b/drivers/net/ethernet/tehuti/tehuti.c >@@ -1965,7 +1965,7 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) > ndev = alloc_etherdev(sizeof(struct bdx_priv)); > if (!ndev) { > err = -ENOMEM; >- goto err_out_iomap; >+ goto err_out_disable_msi; > } > > ndev->netdev_ops = &bdx_netdev_ops; >@@ -2031,7 +2031,7 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) > if (bdx_read_mac(priv)) { > pr_err("load MAC address failed\n"); > err = -EFAULT; >- goto err_out_iomap; >+ goto err_out_disable_msi; > } > SET_NETDEV_DEV(ndev, &pdev->dev); > err = register_netdev(ndev); >@@ -2048,6 +2048,11 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) > > err_out_free: > free_netdev(ndev); >+err_out_disable_msi: >+#ifdef BDX_MSI ifdef does not seem to be necessary here. The irq_type check should be enough. pw-bot: cr >+ if (nic->irq_type == IRQ_MSI) >+ pci_disable_msi(pdev); >+#endif > err_out_iomap: > iounmap(nic->regs); > err_out_res: >-- >2.43.2 > >
Le 28/02/2024 à 10:51, Jiri Pirko a écrit : > Tue, Feb 27, 2024 at 09:50:55PM CET, christophe.jaillet@wanadoo.fr wrote: >> If an error occurs after a successful call to pci_enable_msi(), >> pci_disable_msi() should be called as already done in the remove function. >> >> Add a new label and the missing pci_disable_msi() call. >> >> Fixes: 1a348ccc1047 ("[NET]: Add Tehuti network driver.") >> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> >> --- >> Compile tested only. >> --- >> drivers/net/ethernet/tehuti/tehuti.c | 9 +++++++-- >> 1 file changed, 7 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/net/ethernet/tehuti/tehuti.c b/drivers/net/ethernet/tehuti/tehuti.c >> index ca409515ead5..938a5caf5a3b 100644 >> --- a/drivers/net/ethernet/tehuti/tehuti.c >> +++ b/drivers/net/ethernet/tehuti/tehuti.c >> @@ -1965,7 +1965,7 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) >> ndev = alloc_etherdev(sizeof(struct bdx_priv)); >> if (!ndev) { >> err = -ENOMEM; >> - goto err_out_iomap; >> + goto err_out_disable_msi; >> } >> >> ndev->netdev_ops = &bdx_netdev_ops; >> @@ -2031,7 +2031,7 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) >> if (bdx_read_mac(priv)) { >> pr_err("load MAC address failed\n"); >> err = -EFAULT; >> - goto err_out_iomap; >> + goto err_out_disable_msi; >> } >> SET_NETDEV_DEV(ndev, &pdev->dev); >> err = register_netdev(ndev); >> @@ -2048,6 +2048,11 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) >> >> err_out_free: >> free_netdev(ndev); >> +err_out_disable_msi: >> +#ifdef BDX_MSI > > ifdef does not seem to be necessary here. The irq_type check should be > enough. I thought about removing it, but I left it because it how it is done in the remove function. I'll send a v2 without the ifdef and will also add another patch to remove it as well from the remove function. CJ > > pw-bot: cr > > >> + if (nic->irq_type == IRQ_MSI) >> + pci_disable_msi(pdev); >> +#endif >> err_out_iomap: >> iounmap(nic->regs); >> err_out_res: >> -- >> 2.43.2 >> >> > >
diff --git a/drivers/net/ethernet/tehuti/tehuti.c b/drivers/net/ethernet/tehuti/tehuti.c index ca409515ead5..938a5caf5a3b 100644 --- a/drivers/net/ethernet/tehuti/tehuti.c +++ b/drivers/net/ethernet/tehuti/tehuti.c @@ -1965,7 +1965,7 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ndev = alloc_etherdev(sizeof(struct bdx_priv)); if (!ndev) { err = -ENOMEM; - goto err_out_iomap; + goto err_out_disable_msi; } ndev->netdev_ops = &bdx_netdev_ops; @@ -2031,7 +2031,7 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (bdx_read_mac(priv)) { pr_err("load MAC address failed\n"); err = -EFAULT; - goto err_out_iomap; + goto err_out_disable_msi; } SET_NETDEV_DEV(ndev, &pdev->dev); err = register_netdev(ndev); @@ -2048,6 +2048,11 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) err_out_free: free_netdev(ndev); +err_out_disable_msi: +#ifdef BDX_MSI + if (nic->irq_type == IRQ_MSI) + pci_disable_msi(pdev); +#endif err_out_iomap: iounmap(nic->regs); err_out_res: