Message ID | 20240709143553.117053-1-david.hunter.linux@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 4aa5cc1e0012f784bc7f637458e597564833b425 |
Headers | show |
Series | powerpc-km82xx.c: replace of_node_put with __free improves cleanup | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/github-powerpc_ppctests | success | Successfully ran 8 jobs. |
snowpatch_ozlabs/github-powerpc_selftests | success | Successfully ran 8 jobs. |
snowpatch_ozlabs/github-powerpc_clang | success | Successfully ran 5 jobs. |
snowpatch_ozlabs/github-powerpc_sparse | success | Successfully ran 4 jobs. |
snowpatch_ozlabs/github-powerpc_kernel_qemu | success | Successfully ran 21 jobs. |
On Tue, 09 Jul 2024 10:35:53 -0400, David Hunter wrote: > The use of the __free function allows the cleanup to be based on scope > instead of on another function called later. This makes the cleanup > automatic and less susceptible to errors later. > > This code was compiled without errors or warnings. > > > [...] Applied to powerpc/next. [1/1] powerpc-km82xx.c: replace of_node_put with __free improves cleanup https://git.kernel.org/powerpc/c/4aa5cc1e0012f784bc7f637458e597564833b425 cheers
diff --git a/arch/powerpc/platforms/82xx/km82xx.c b/arch/powerpc/platforms/82xx/km82xx.c index c86da3f2b74b..5791c9c5acd0 100644 --- a/arch/powerpc/platforms/82xx/km82xx.c +++ b/arch/powerpc/platforms/82xx/km82xx.c @@ -27,15 +27,15 @@ static void __init km82xx_pic_init(void) { - struct device_node *np = of_find_compatible_node(NULL, NULL, - "fsl,pq2-pic"); + struct device_node *np __free(device_node) = of_find_compatible_node(NULL, + NULL, + "fsl,pq2-pic"); if (!np) { pr_err("PIC init: can not find cpm-pic node\n"); return; } cpm2_pic_init(np); - of_node_put(np); } struct cpm_pin {
The use of the __free function allows the cleanup to be based on scope instead of on another function called later. This makes the cleanup automatic and less susceptible to errors later. This code was compiled without errors or warnings. Signed-off-by: David Hunter <david.hunter.linux@gmail.com> --- arch/powerpc/platforms/82xx/km82xx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)