__free() provides a scoped of_node_put() functionality to put the device_node automatically, and we don't need to call of_node_put() directly. Let's simplify the code a bit with the use of __free(). Signed-off-by: Zhang Zekun <zhangzekun11@xxxxxxxxxx> --- drivers/of/irq.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 36351ad6115e..3291f1ffea49 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -341,7 +341,7 @@ EXPORT_SYMBOL_GPL(of_irq_parse_raw); */ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_args *out_irq) { - struct device_node *p; + struct device_node *p __free(device_node) = NULL; const __be32 *addr; u32 intsize; int i, res, addr_len; @@ -374,10 +374,8 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar return -EINVAL; /* Get size of interrupt specifier */ - if (of_property_read_u32(p, "#interrupt-cells", &intsize)) { - res = -EINVAL; - goto out; - } + if (of_property_read_u32(p, "#interrupt-cells", &intsize)) + return -EINVAL; pr_debug(" parent=%pOF, intsize=%d\n", p, intsize); @@ -389,17 +387,14 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar (index * intsize) + i, out_irq->args + i); if (res) - goto out; + return res; } pr_debug(" intspec=%d\n", *out_irq->args); /* Check if there are any interrupt-map translations to process */ - res = of_irq_parse_raw(addr_buf, out_irq); - out: - of_node_put(p); - return res; + return of_irq_parse_raw(addr_buf, out_irq); } EXPORT_SYMBOL_GPL(of_irq_parse_one); -- 2.17.1