Commit dee89bf6 authored by Wen Yang's avatar Wen Yang Committed by Greg Kroah-Hartman

media: venus: firmware: fix leaked of_node references

[ Upstream commit 2c41cc0b ]

The call to of_parse_phandle returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.

Detected by coccinelle with the following warnings:
drivers/media/platform/qcom/venus/firmware.c:90:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 82, but without a corresponding object release within this function.
drivers/media/platform/qcom/venus/firmware.c:94:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 82, but without a corresponding object release within this function.
drivers/media/platform/qcom/venus/firmware.c:128:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 82, but without a corresponding object release within this function.
Signed-off-by: default avatarWen Yang <wen.yang99@zte.com.cn>
Acked-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 5d7590c8
...@@ -87,11 +87,11 @@ static int venus_load_fw(struct venus_core *core, const char *fwname, ...@@ -87,11 +87,11 @@ static int venus_load_fw(struct venus_core *core, const char *fwname,
ret = of_address_to_resource(node, 0, &r); ret = of_address_to_resource(node, 0, &r);
if (ret) if (ret)
return ret; goto err_put_node;
ret = request_firmware(&mdt, fwname, dev); ret = request_firmware(&mdt, fwname, dev);
if (ret < 0) if (ret < 0)
return ret; goto err_put_node;
fw_size = qcom_mdt_get_size(mdt); fw_size = qcom_mdt_get_size(mdt);
if (fw_size < 0) { if (fw_size < 0) {
...@@ -125,6 +125,8 @@ static int venus_load_fw(struct venus_core *core, const char *fwname, ...@@ -125,6 +125,8 @@ static int venus_load_fw(struct venus_core *core, const char *fwname,
memunmap(mem_va); memunmap(mem_va);
err_release_fw: err_release_fw:
release_firmware(mdt); release_firmware(mdt);
err_put_node:
of_node_put(node);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment