linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] bnxt_en: fix error return code in bnxt_init_board()
@ 2020-11-19 13:30 Zhang Changzhong
  2020-11-19 18:53 ` Edwin Peer
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang Changzhong @ 2020-11-19 13:30 UTC (permalink / raw)
  To: michael.chan, davem, kuba, prashant, huangjw, eddie.wai
  Cc: netdev, linux-kernel

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 7c21aaa8..11d0542 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -11590,6 +11590,7 @@ static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev)
 	if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) != 0 &&
 	    dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)) != 0) {
 		dev_err(&pdev->dev, "System does not support DMA, aborting\n");
+		rc = -EIO;
 		goto init_err_disable;
 	}
 
-- 
2.9.5


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] bnxt_en: fix error return code in bnxt_init_board()
  2020-11-19 13:30 [PATCH net] bnxt_en: fix error return code in bnxt_init_board() Zhang Changzhong
@ 2020-11-19 18:53 ` Edwin Peer
  2020-11-20  5:53   ` Jakub Kicinski
  0 siblings, 1 reply; 4+ messages in thread
From: Edwin Peer @ 2020-11-19 18:53 UTC (permalink / raw)
  To: Zhang Changzhong
  Cc: Michael Chan, David S . Miller, Jakub Kicinski, prashant,
	huangjw, Eddie Wai, netdev, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 1214 bytes --]

On Thu, Nov 19, 2020 at 5:29 AM Zhang Changzhong
<zhangchangzhong@huawei.com> wrote:

> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
>
> Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
> ---
>  drivers/net/ethernet/broadcom/bnxt/bnxt.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> index 7c21aaa8..11d0542 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> @@ -11590,6 +11590,7 @@ static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev)
>         if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) != 0 &&
>             dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)) != 0) {
>                 dev_err(&pdev->dev, "System does not support DMA, aborting\n");
> +               rc = -EIO;
>                 goto init_err_disable;
>         }
>
> --
> 2.9.5

Reviewed-by: Edwin Peer <edwin.peer@broadcom.com>

Regards,
Edwin Peer

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4160 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] bnxt_en: fix error return code in bnxt_init_board()
  2020-11-19 18:53 ` Edwin Peer
@ 2020-11-20  5:53   ` Jakub Kicinski
  2020-11-20  7:17     ` Michael Chan
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2020-11-20  5:53 UTC (permalink / raw)
  To: Edwin Peer
  Cc: Zhang Changzhong, Michael Chan, David S . Miller, prashant,
	huangjw, Eddie Wai, netdev, Linux Kernel Mailing List

On Thu, 19 Nov 2020 10:53:23 -0800 Edwin Peer wrote:
> > Fix to return a negative error code from the error handling
> > case instead of 0, as done elsewhere in this function.
> >
> > Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.")
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>

> >         if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) != 0 &&
> >             dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)) != 0) {
> >                 dev_err(&pdev->dev, "System does not support DMA, aborting\n");
> > +               rc = -EIO;
> >                 goto init_err_disable;

Edwin, please double check if this shouldn't jump to 
pci_release_regions() (or maybe it's harmless 'cause 
PCI likes to magically release things on its own).

> >         }
> 
> Reviewed-by: Edwin Peer <edwin.peer@broadcom.com>

Applied thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] bnxt_en: fix error return code in bnxt_init_board()
  2020-11-20  5:53   ` Jakub Kicinski
@ 2020-11-20  7:17     ` Michael Chan
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Chan @ 2020-11-20  7:17 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Edwin Peer, Zhang Changzhong, David S . Miller,
	Prashant Sreedharan, Jeffrey Huang, Eddie Wai, netdev,
	Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 1067 bytes --]

On Thu, Nov 19, 2020 at 9:53 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Thu, 19 Nov 2020 10:53:23 -0800 Edwin Peer wrote:
> > > Fix to return a negative error code from the error handling
> > > case instead of 0, as done elsewhere in this function.
> > >
> > > Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.")
> > > Reported-by: Hulk Robot <hulkci@huawei.com>
> > > Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
>
> > >         if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) != 0 &&
> > >             dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)) != 0) {
> > >                 dev_err(&pdev->dev, "System does not support DMA, aborting\n");
> > > +               rc = -EIO;
> > >                 goto init_err_disable;
>
> Edwin, please double check if this shouldn't jump to
> pci_release_regions() (or maybe it's harmless 'cause
> PCI likes to magically release things on its own).

Good point.  We definitely should call pci_release_regions() for correctness.

I will send out the patch shortly.  Thanks.

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4166 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-20  7:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-19 13:30 [PATCH net] bnxt_en: fix error return code in bnxt_init_board() Zhang Changzhong
2020-11-19 18:53 ` Edwin Peer
2020-11-20  5:53   ` Jakub Kicinski
2020-11-20  7:17     ` Michael Chan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).