On Tue, 2 Dec 2008 14:48:13 +0100 Nicolas Palix <npalix at diku.dk> wrote: > > of_node_put is needed before discarding a value received from > of_find_node_by_name, eg in error handling code or when the device > node is no longer used. > > Signed-off-by: Nicolas Palix <npalix at diku.dk> > Signed-off-by: Julia Lawall <julia at diku.dk> > --- > drivers/hwmon/ams/ams-core.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/drivers/hwmon/ams/ams-core.c b/drivers/hwmon/ams/ams-core.c > index 6c9ace1..e612af9 100644 > --- a/drivers/hwmon/ams/ams-core.c > +++ b/drivers/hwmon/ams/ams-core.c > @@ -202,6 +202,7 @@ int __init ams_init(void) > if (np && of_device_is_compatible(np, "AAPL,accelerometer_1")) > /* Found I2C motion sensor */ > return ams_i2c_init(np); > + of_node_put(np); This is wrong because if CONFIG_SENSORS_AMS_PMU is set, np is used again below. > #endif > > #ifdef CONFIG_SENSORS_AMS_PMU > @@ -209,6 +210,7 @@ int __init ams_init(void) > if (np && of_device_is_compatible(np, "sms")) > /* Found PMU motion sensor */ > return ams_pmu_init(np); > + of_node_put(np); > #endif > return -ENODEV; > } Also, I don't like this code since each of ams_i2c_init and ams_pmu_init keep a reference to np, so they should be doing an of_node_get(np) and this code above should be unconditionally doing an of_node_put(np). This is not your problem, though. -- Cheers, Stephen Rothwell sfr at canb.auug.org.au http://www.canb.auug.org.au/~sfr/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: not available Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20081203/9ad65472/attachment.bin