All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: marvell: prestera: fix error return code in prestera_pci_probe()
@ 2020-11-13 11:32 Wang Hai
  2020-11-13 12:50 ` Vadym Kochan
  2020-11-13 23:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Wang Hai @ 2020-11-13 11:32 UTC (permalink / raw)
  To: davem, kuba, oleksandr.mazur, vadym.kochan; +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: 4c2703dfd7fa ("net: marvell: prestera: Add PCI interface support")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
---
 drivers/net/ethernet/marvell/prestera/prestera_pci.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/prestera/prestera_pci.c b/drivers/net/ethernet/marvell/prestera/prestera_pci.c
index 1b97adae542e..be5677623455 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera_pci.c
+++ b/drivers/net/ethernet/marvell/prestera/prestera_pci.c
@@ -676,7 +676,8 @@ static int prestera_pci_probe(struct pci_dev *pdev,
 	if (err)
 		return err;
 
-	if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(30))) {
+	err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(30));
+	if (err) {
 		dev_err(&pdev->dev, "fail to set DMA mask\n");
 		goto err_dma_mask;
 	}
@@ -702,8 +703,10 @@ static int prestera_pci_probe(struct pci_dev *pdev,
 	dev_info(fw->dev.dev, "Prestera FW is ready\n");
 
 	fw->wq = alloc_workqueue("prestera_fw_wq", WQ_HIGHPRI, 1);
-	if (!fw->wq)
+	if (!fw->wq) {
+		err = -ENOMEM;
 		goto err_wq_alloc;
+	}
 
 	INIT_WORK(&fw->evt_work, prestera_fw_evt_work_fn);
 
-- 
2.17.1


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

* Re: [PATCH net] net: marvell: prestera: fix error return code in prestera_pci_probe()
  2020-11-13 11:32 [PATCH net] net: marvell: prestera: fix error return code in prestera_pci_probe() Wang Hai
@ 2020-11-13 12:50 ` Vadym Kochan
  2020-11-13 23:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Vadym Kochan @ 2020-11-13 12:50 UTC (permalink / raw)
  To: Wang Hai; +Cc: davem, kuba, oleksandr.mazur, vadym.kochan, netdev, linux-kernel


Hi Wang,

Wang Hai <wanghai38@huawei.com> writes:

> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
>
> Fixes: 4c2703dfd7fa ("net: marvell: prestera: Add PCI interface support")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wang Hai <wanghai38@huawei.com>
> ---
>  drivers/net/ethernet/marvell/prestera/prestera_pci.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/prestera/prestera_pci.c b/drivers/net/ethernet/marvell/prestera/prestera_pci.c
> index 1b97adae542e..be5677623455 100644
> --- a/drivers/net/ethernet/marvell/prestera/prestera_pci.c
> +++ b/drivers/net/ethernet/marvell/prestera/prestera_pci.c
> @@ -676,7 +676,8 @@ static int prestera_pci_probe(struct pci_dev *pdev,
>  	if (err)
>  		return err;
>  
> -	if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(30))) {
> +	err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(30));
> +	if (err) {
>  		dev_err(&pdev->dev, "fail to set DMA mask\n");
>  		goto err_dma_mask;
>  	}
> @@ -702,8 +703,10 @@ static int prestera_pci_probe(struct pci_dev *pdev,
>  	dev_info(fw->dev.dev, "Prestera FW is ready\n");
>  
>  	fw->wq = alloc_workqueue("prestera_fw_wq", WQ_HIGHPRI, 1);
> -	if (!fw->wq)
> +	if (!fw->wq) {
> +		err = -ENOMEM;
>  		goto err_wq_alloc;
> +	}
>  
>  	INIT_WORK(&fw->evt_work, prestera_fw_evt_work_fn);

Thank you!

Just in case it is needed:

Reviewed-by: Vadym Kochan <vadym.kochan@plvision.eu>
Acked-by: Vadym Kochan <vadym.kochan@plvision.eu>

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

* Re: [PATCH net] net: marvell: prestera: fix error return code in prestera_pci_probe()
  2020-11-13 11:32 [PATCH net] net: marvell: prestera: fix error return code in prestera_pci_probe() Wang Hai
  2020-11-13 12:50 ` Vadym Kochan
@ 2020-11-13 23:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2020-11-13 23:20 UTC (permalink / raw)
  To: Wang Hai; +Cc: davem, kuba, oleksandr.mazur, vadym.kochan, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Fri, 13 Nov 2020 19:32:36 +0800 you wrote:
> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
> 
> Fixes: 4c2703dfd7fa ("net: marvell: prestera: Add PCI interface support")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wang Hai <wanghai38@huawei.com>
> 
> [...]

Here is the summary with links:
  - [net] net: marvell: prestera: fix error return code in prestera_pci_probe()
    https://git.kernel.org/netdev/net/c/8c07205aea36

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13 11:32 [PATCH net] net: marvell: prestera: fix error return code in prestera_pci_probe() Wang Hai
2020-11-13 12:50 ` Vadym Kochan
2020-11-13 23:20 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.