mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2024-12-28 16:53:49 +00:00
remoteproc: k3: Call of_node_put(rmem_np) only once in three functions
An of_node_put(rmem_np) call was immediately used after a pointer check for a of_reserved_mem_lookup() call in three function implementations. Thus call such a function only once instead directly before the checks. This issue was transformed by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Link: https://lore.kernel.org/r/c46b06f9-72b1-420b-9dce-a392b982140e@web.de Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
This commit is contained in:
parent
9852d85ec9
commit
a36d9f96d1
@ -576,11 +576,9 @@ static int k3_dsp_reserved_mem_init(struct k3_dsp_rproc *kproc)
|
||||
return -EINVAL;
|
||||
|
||||
rmem = of_reserved_mem_lookup(rmem_np);
|
||||
if (!rmem) {
|
||||
of_node_put(rmem_np);
|
||||
return -EINVAL;
|
||||
}
|
||||
of_node_put(rmem_np);
|
||||
if (!rmem)
|
||||
return -EINVAL;
|
||||
|
||||
kproc->rmem[i].bus_addr = rmem->base;
|
||||
/* 64-bit address regions currently not supported */
|
||||
|
@ -433,11 +433,9 @@ static int k3_m4_reserved_mem_init(struct k3_m4_rproc *kproc)
|
||||
return -EINVAL;
|
||||
|
||||
rmem = of_reserved_mem_lookup(rmem_np);
|
||||
if (!rmem) {
|
||||
of_node_put(rmem_np);
|
||||
return -EINVAL;
|
||||
}
|
||||
of_node_put(rmem_np);
|
||||
if (!rmem)
|
||||
return -EINVAL;
|
||||
|
||||
kproc->rmem[i].bus_addr = rmem->base;
|
||||
/* 64-bit address regions currently not supported */
|
||||
|
@ -1001,12 +1001,11 @@ static int k3_r5_reserved_mem_init(struct k3_r5_rproc *kproc)
|
||||
}
|
||||
|
||||
rmem = of_reserved_mem_lookup(rmem_np);
|
||||
of_node_put(rmem_np);
|
||||
if (!rmem) {
|
||||
of_node_put(rmem_np);
|
||||
ret = -EINVAL;
|
||||
goto unmap_rmem;
|
||||
}
|
||||
of_node_put(rmem_np);
|
||||
|
||||
kproc->rmem[i].bus_addr = rmem->base;
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user