提交 e349734f 编写于 作者: M Miaoqian Lin 提交者: Zheng Zengkai

watchdog: ts4800_wdt: Fix refcount leak in ts4800_wdt_probe

stable inclusion
from stable-v5.10.122
commit 910b1cdf6c50ae8fb222e46657d04fb181577017
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5W6OE

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=910b1cdf6c50ae8fb222e46657d04fb181577017

--------------------------------

[ Upstream commit 5d24df3d ]

of_parse_phandle() returns a node pointer with refcount
incremented, we should use of_node_put() on it when done.
Add  missing of_node_put() in some error paths.

Fixes: bf900639 ("watchdog: ts4800: add driver for TS-4800 watchdog")
Signed-off-by: NMiaoqian Lin <linmq006@gmail.com>
Reviewed-by: NGuenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20220511114203.47420-1-linmq006@gmail.comSigned-off-by: NGuenter Roeck <linux@roeck-us.net>
Signed-off-by: NWim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
上级 a7635f6e
......@@ -125,13 +125,16 @@ static int ts4800_wdt_probe(struct platform_device *pdev)
ret = of_property_read_u32_index(np, "syscon", 1, &reg);
if (ret < 0) {
dev_err(dev, "no offset in syscon\n");
of_node_put(syscon_np);
return ret;
}
/* allocate memory for watchdog struct */
wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL);
if (!wdt)
if (!wdt) {
of_node_put(syscon_np);
return -ENOMEM;
}
/* set regmap and offset to know where to write */
wdt->feed_offset = reg;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册