aboutsummaryrefslogtreecommitdiff
path: root/drivers/macintosh
diff options
context:
space:
mode:
authorGravatar sundar <prosunofficial@gmail.com> 2024-04-24 20:37:18 +0530
committerGravatar Michael Ellerman <mpe@ellerman.id.au> 2024-04-30 21:53:13 +1000
commit84030aacf127d000180fa3cb4b589d8ab1b0d46b (patch)
tree6890e907f04cf5481719c3151acba9a0f8071856 /drivers/macintosh
parentselftests/powerpc: Install tests in sub-directories (diff)
downloadlinux-84030aacf127d000180fa3cb4b589d8ab1b0d46b.tar.gz
linux-84030aacf127d000180fa3cb4b589d8ab1b0d46b.tar.bz2
linux-84030aacf127d000180fa3cb4b589d8ab1b0d46b.zip
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: Julia Lawall <julia.lawall@inria.fr> Signed-off-by: sundar <prosunofficial@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20240424150718.5006-1-prosunofficial@gmail.com
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/macio-adb.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/macintosh/macio-adb.c b/drivers/macintosh/macio-adb.c
index 779f1268286e..19c63959ebed 100644
--- a/drivers/macintosh/macio-adb.c
+++ b/drivers/macintosh/macio-adb.c
@@ -83,35 +83,32 @@ struct adb_driver macio_adb_driver = {
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) {
- of_node_put(np);
+ if (np)
return 0;
- }
+
return -ENODEV;
}
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;
unsigned int irq;
- adbs = of_find_compatible_node(NULL, "adb", "chrp,adb0");
if (!adbs)
return -ENXIO;
- if (of_address_to_resource(adbs, 0, &r)) {
- of_node_put(adbs);
+ if (of_address_to_resource(adbs, 0, &r))
return -ENXIO;
- }
+
adb = ioremap(r.start, sizeof(struct adb_regs));
- if (!adb) {
- of_node_put(adbs);
+ if (!adb)
return -ENOMEM;
- }
+
out_8(&adb->ctrl.r, 0);
out_8(&adb->intr.r, 0);
@@ -121,7 +118,6 @@ int macio_init(void)
out_8(&adb->autopoll.r, APE);
irq = irq_of_parse_and_map(adbs, 0);
- of_node_put(adbs);
if (request_irq(irq, macio_adb_interrupt, 0, "ADB", (void *)0)) {
iounmap(adb);
printk(KERN_ERR "ADB: can't get irq %d\n", irq);