diff mbox series

[-next] net: cpsw: add missing of_node_put() in cpsw_probe_dt()

Message ID 20220426124757.373587-1-yangyingliang@huawei.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [-next] net: cpsw: add missing of_node_put() in cpsw_probe_dt() | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
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 fail 2 blamed authors not CCed: m-karicheri2@ti.com ilias.apalodimas@linaro.org; 6 maintainers not CCed: chi.minghao@zte.com.cn ilias.apalodimas@linaro.org pabeni@redhat.com m-karicheri2@ti.com linux-omap@vger.kernel.org vladimir.oltean@nxp.com
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/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, 11 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Yang Yingliang April 26, 2022, 12:47 p.m. UTC
If devm_kcalloc() fails, 'tmp_node' should be put in cpsw_probe_dt().

Fixes: ed3525eda4c4 ("net: ethernet: ti: introduce cpsw switchdev based driver part 1 - dual-emac")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/net/ethernet/ti/cpsw_new.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jakub Kicinski April 28, 2022, 12:52 a.m. UTC | #1
On Tue, 26 Apr 2022 20:47:57 +0800 Yang Yingliang wrote:
> Subject: [PATCH -next] net: cpsw: add missing of_node_put() in cpsw_probe_dt()

Why next? The commit under Fixes is in Linus's tree.

Please sort this out and repost.

> If devm_kcalloc() fails, 'tmp_node' should be put in cpsw_probe_dt().
> 
> Fixes: ed3525eda4c4 ("net: ethernet: ti: introduce cpsw switchdev based driver part 1 - dual-emac")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Yang Yingliang April 28, 2022, 1:30 a.m. UTC | #2
On 2022/4/28 8:52, Jakub Kicinski wrote:
> On Tue, 26 Apr 2022 20:47:57 +0800 Yang Yingliang wrote:
>> Subject: [PATCH -next] net: cpsw: add missing of_node_put() in cpsw_probe_dt()
> Why next? The commit under Fixes is in Linus's tree.
>
> Please sort this out and repost.
It supposed to net, I write a wrong title, I will resend it.

Thanks,
Yang
>
>> If devm_kcalloc() fails, 'tmp_node' should be put in cpsw_probe_dt().
>>
>> Fixes: ed3525eda4c4 ("net: ethernet: ti: introduce cpsw switchdev based driver part 1 - dual-emac")
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> .
diff mbox series

Patch

diff --git a/drivers/net/ethernet/ti/cpsw_new.c b/drivers/net/ethernet/ti/cpsw_new.c
index bd4b1528cf99..b81179f7d738 100644
--- a/drivers/net/ethernet/ti/cpsw_new.c
+++ b/drivers/net/ethernet/ti/cpsw_new.c
@@ -1246,8 +1246,10 @@  static int cpsw_probe_dt(struct cpsw_common *cpsw)
 	data->slave_data = devm_kcalloc(dev, CPSW_SLAVE_PORTS_NUM,
 					sizeof(struct cpsw_slave_data),
 					GFP_KERNEL);
-	if (!data->slave_data)
+	if (!data->slave_data) {
+		of_node_put(tmp_node);
 		return -ENOMEM;
+	}
 
 	/* Populate all the child nodes here...
 	 */