diff options
author | Julia Lawall <julia@diku.dk> | 2008-06-09 08:21:51 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-06-16 01:00:39 -0400 |
commit | 958a65f205fdc5ce5461d79376073b89acc51b31 (patch) | |
tree | ea5831ca25e8468929baa37a0516a2da15f5b882 /drivers/macintosh/therm_adt746x.c | |
parent | 8b9dba2ce28f64246198704b23f133bed5429e62 (diff) |
[POWERPC] Add missing of_node_put in drivers/macintosh/therm_adt746x.c
of_node_put is needed before discarding a value received from
of_find_node_by_name, eg in error handling code.
The semantic patch that makes the change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@@
struct device_node *n;
struct device_node *n1;
statement S;
identifier f;
expression E;
constant C;
@@
n = of_find_node_by_name(...)
...
if (!n) S
... when != of_node_put(n)
when != n1 = f(n,...)
when != E = n
when any
when strict
(
+ of_node_put(n);
return -C;
|
of_node_put(n);
|
n1 = f(n,...)
|
E = n
|
return ...;
)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers/macintosh/therm_adt746x.c')
-rw-r--r-- | drivers/macintosh/therm_adt746x.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c index 54f4942a2968..5366dc93fb38 100644 --- a/drivers/macintosh/therm_adt746x.c +++ b/drivers/macintosh/therm_adt746x.c | |||
@@ -562,18 +562,24 @@ thermostat_init(void) | |||
562 | therm_type = ADT7460; | 562 | therm_type = ADT7460; |
563 | else if (of_device_is_compatible(np, "adt7467")) | 563 | else if (of_device_is_compatible(np, "adt7467")) |
564 | therm_type = ADT7467; | 564 | therm_type = ADT7467; |
565 | else | 565 | else { |
566 | of_node_put(np); | ||
566 | return -ENODEV; | 567 | return -ENODEV; |
568 | } | ||
567 | 569 | ||
568 | prop = of_get_property(np, "hwsensor-params-version", NULL); | 570 | prop = of_get_property(np, "hwsensor-params-version", NULL); |
569 | printk(KERN_INFO "adt746x: version %d (%ssupported)\n", *prop, | 571 | printk(KERN_INFO "adt746x: version %d (%ssupported)\n", *prop, |
570 | (*prop == 1)?"":"un"); | 572 | (*prop == 1)?"":"un"); |
571 | if (*prop != 1) | 573 | if (*prop != 1) { |
574 | of_node_put(np); | ||
572 | return -ENODEV; | 575 | return -ENODEV; |
576 | } | ||
573 | 577 | ||
574 | prop = of_get_property(np, "reg", NULL); | 578 | prop = of_get_property(np, "reg", NULL); |
575 | if (!prop) | 579 | if (!prop) { |
580 | of_node_put(np); | ||
576 | return -ENODEV; | 581 | return -ENODEV; |
582 | } | ||
577 | 583 | ||
578 | /* look for bus either by path or using "reg" */ | 584 | /* look for bus either by path or using "reg" */ |
579 | if (strstr(np->full_name, "/i2c-bus@") != NULL) { | 585 | if (strstr(np->full_name, "/i2c-bus@") != NULL) { |
@@ -610,6 +616,7 @@ thermostat_init(void) | |||
610 | 616 | ||
611 | if (of_dev == NULL) { | 617 | if (of_dev == NULL) { |
612 | printk(KERN_ERR "Can't register temperatures device !\n"); | 618 | printk(KERN_ERR "Can't register temperatures device !\n"); |
619 | of_node_put(np); | ||
613 | return -ENODEV; | 620 | return -ENODEV; |
614 | } | 621 | } |
615 | 622 | ||