Commit 84030aac authored by sundar's avatar sundar Committed by Michael Ellerman

macintosh/macio-adb: replace of_node_put() with __free

use the new cleanup magic to replace of_node_put() with
__free(device_node) marking to auto release when they get out of scope.
Suggested-by: default avatarJulia Lawall <julia.lawall@inria.fr>
Signed-off-by: default avatarsundar <prosunofficial@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240424150718.5006-1-prosunofficial@gmail.com
parent dda32e37
...@@ -83,35 +83,32 @@ struct adb_driver macio_adb_driver = { ...@@ -83,35 +83,32 @@ struct adb_driver macio_adb_driver = {
int macio_probe(void) int macio_probe(void)
{ {
struct device_node *np; struct device_node *np __free(device_node) =
of_find_compatible_node(NULL, "adb", "chrp,adb0");
np = of_find_compatible_node(NULL, "adb", "chrp,adb0"); if (np)
if (np) {
of_node_put(np);
return 0; return 0;
}
return -ENODEV; return -ENODEV;
} }
int macio_init(void) int macio_init(void)
{ {
struct device_node *adbs; struct device_node *adbs __free(device_node) =
of_find_compatible_node(NULL, "adb", "chrp,adb0");
struct resource r; struct resource r;
unsigned int irq; unsigned int irq;
adbs = of_find_compatible_node(NULL, "adb", "chrp,adb0");
if (!adbs) if (!adbs)
return -ENXIO; return -ENXIO;
if (of_address_to_resource(adbs, 0, &r)) { if (of_address_to_resource(adbs, 0, &r))
of_node_put(adbs);
return -ENXIO; return -ENXIO;
}
adb = ioremap(r.start, sizeof(struct adb_regs)); adb = ioremap(r.start, sizeof(struct adb_regs));
if (!adb) { if (!adb)
of_node_put(adbs);
return -ENOMEM; return -ENOMEM;
}
out_8(&adb->ctrl.r, 0); out_8(&adb->ctrl.r, 0);
out_8(&adb->intr.r, 0); out_8(&adb->intr.r, 0);
...@@ -121,7 +118,6 @@ int macio_init(void) ...@@ -121,7 +118,6 @@ int macio_init(void)
out_8(&adb->autopoll.r, APE); out_8(&adb->autopoll.r, APE);
irq = irq_of_parse_and_map(adbs, 0); irq = irq_of_parse_and_map(adbs, 0);
of_node_put(adbs);
if (request_irq(irq, macio_adb_interrupt, 0, "ADB", (void *)0)) { if (request_irq(irq, macio_adb_interrupt, 0, "ADB", (void *)0)) {
iounmap(adb); iounmap(adb);
printk(KERN_ERR "ADB: can't get irq %d\n", irq); printk(KERN_ERR "ADB: can't get irq %d\n", irq);
......
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