diff mbox series

[net] net: marvell: prestera: fix error return code in prestera_pci_probe()

Message ID 20201113113236.71678-1-wanghai38@huawei.com (mailing list archive)
State Accepted
Commit 8c07205aea36ccebe9fc5f97287a8bc416cea197
Delegated to: Netdev Maintainers
Headers show
Series [net] net: marvell: prestera: fix error return code in prestera_pci_probe() | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 20 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Wang Hai Nov. 13, 2020, 11:32 a.m. UTC
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(-)

Comments

Vadym Kochan Nov. 13, 2020, 12:50 p.m. UTC | #1
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>
patchwork-bot+netdevbpf@kernel.org Nov. 13, 2020, 11:20 p.m. UTC | #2
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
diff mbox series

Patch

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);