On Wednesday 23 July 2008, Greg KH wrote: > > In this case adding > > > > if (!class->p) > > return -EINVAL; > > > > at the top of class_for_each_device() would prevent such > > oopses from ever happening. > > Makes sense, care to send a real patch for this?
Here you go ... I noticed another place with the same type of oops-affinity, and fixed that too. ===== CUT HERE From: David Brownell <[EMAIL PROTECTED]> Anti-oops medicine for the class iterators ... the oops was observed when a class was implicitly referenced before it was initialized. Signed-off-by: David Brownell <[EMAIL PROTECTED]> --- drivers/base/class.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/base/class.c 2008-07-22 15:27:52.000000000 -0700 +++ b/drivers/base/class.c 2008-07-23 16:39:58.000000000 -0700 @@ -292,7 +292,7 @@ int class_for_each_device(struct class * struct device *dev; int error = 0; - if (!class) + if (!class || !class->p) return -EINVAL; mutex_lock(&class->p->class_mutex); list_for_each_entry(dev, &class->p->class_devices, node) { @@ -341,7 +341,7 @@ struct device *class_find_device(struct struct device *dev; int found = 0; - if (!class) + if (!class || !class->p) return NULL; mutex_lock(&class->p->class_mutex); _______________________________________________ i2c mailing list i2c@lm-sensors.org http://lists.lm-sensors.org/mailman/listinfo/i2c