diff mbox series

[net-next,v2] net: ethernet: mtk_wed: Fix missing of_node_put() in mtk_wed_wo_hardware_init()

Message ID 20221205034339.112163-1-yuancan@huawei.com (mailing list archive)
State Accepted
Commit e22dcbc9aa329e7902a8c9f8d11aba74f5d7c97d
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v2] net: ethernet: mtk_wed: Fix missing of_node_put() in mtk_wed_wo_hardware_init() | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 14 of 14 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 21 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Yuan Can Dec. 5, 2022, 3:43 a.m. UTC
The np needs to be released through of_node_put() in the error handling
path of mtk_wed_wo_hardware_init().

Fixes: 799684448e3e ("net: ethernet: mtk_wed: introduce wed wo support")
Signed-off-by: Yuan Can <yuancan@huawei.com>
---
Changes in v2:
- Replace IS_ERR_OR_NULL() with IS_ERR() to check wo->mmio.regs.
- Add net-next tag.

 drivers/net/ethernet/mediatek/mtk_wed_wo.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Leon Romanovsky Dec. 5, 2022, 8 a.m. UTC | #1
On Mon, Dec 05, 2022 at 03:43:39AM +0000, Yuan Can wrote:
> The np needs to be released through of_node_put() in the error handling
> path of mtk_wed_wo_hardware_init().
> 
> Fixes: 799684448e3e ("net: ethernet: mtk_wed: introduce wed wo support")
> Signed-off-by: Yuan Can <yuancan@huawei.com>
> ---
> Changes in v2:
> - Replace IS_ERR_OR_NULL() with IS_ERR() to check wo->mmio.regs.
> - Add net-next tag.
> 
>  drivers/net/ethernet/mediatek/mtk_wed_wo.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
patchwork-bot+netdevbpf@kernel.org Dec. 7, 2022, 11 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (master)
by Paolo Abeni <pabeni@redhat.com>:

On Mon, 5 Dec 2022 03:43:39 +0000 you wrote:
> The np needs to be released through of_node_put() in the error handling
> path of mtk_wed_wo_hardware_init().
> 
> Fixes: 799684448e3e ("net: ethernet: mtk_wed: introduce wed wo support")
> Signed-off-by: Yuan Can <yuancan@huawei.com>
> ---
> Changes in v2:
> - Replace IS_ERR_OR_NULL() with IS_ERR() to check wo->mmio.regs.
> - Add net-next tag.
> 
> [...]

Here is the summary with links:
  - [net-next,v2] net: ethernet: mtk_wed: Fix missing of_node_put() in mtk_wed_wo_hardware_init()
    https://git.kernel.org/netdev/net-next/c/e22dcbc9aa32

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mediatek/mtk_wed_wo.c b/drivers/net/ethernet/mediatek/mtk_wed_wo.c
index 4754b6db009e..fcc4b3206d2d 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed_wo.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed_wo.c
@@ -407,8 +407,10 @@  mtk_wed_wo_hardware_init(struct mtk_wed_wo *wo)
 		return -ENODEV;
 
 	wo->mmio.regs = syscon_regmap_lookup_by_phandle(np, NULL);
-	if (IS_ERR_OR_NULL(wo->mmio.regs))
-		return PTR_ERR(wo->mmio.regs);
+	if (IS_ERR(wo->mmio.regs)) {
+		ret = PTR_ERR(wo->mmio.regs);
+		goto error_put;
+	}
 
 	wo->mmio.irq = irq_of_parse_and_map(np, 0);
 	wo->mmio.irq_mask = MTK_WED_WO_ALL_INT_MASK;
@@ -456,7 +458,8 @@  mtk_wed_wo_hardware_init(struct mtk_wed_wo *wo)
 
 error:
 	devm_free_irq(wo->hw->dev, wo->mmio.irq, wo);
-
+error_put:
+	of_node_put(np);
 	return ret;
 }