Re: 2.6.16-rc1-mm1

From: Andrew Morton
Date: Wed Jan 18 2006 - 16:40:28 EST


Dave Jones <davej@xxxxxxxxxx> wrote:
>
> With the patch above we'll mutex_unlock twice.

I was just testing you.

> Is that allowed ? It sounds wrong to me.

It worked!


From: Andrew Morton <akpm@xxxxxxxx>

Make the cpufreq code play nicely with the mutex debugging code: don't free a
held mutex.

Cc: Dave Jones <davej@xxxxxxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

drivers/cpufreq/cpufreq.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)

diff -puN drivers/cpufreq/cpufreq.c~cpufreq-mutex-locking-fix drivers/cpufreq/cpufreq.c
--- devel/drivers/cpufreq/cpufreq.c~cpufreq-mutex-locking-fix 2006-01-18 13:37:09.000000000 -0800
+++ devel-akpm/drivers/cpufreq/cpufreq.c 2006-01-18 13:38:20.000000000 -0800
@@ -612,6 +612,7 @@ static int cpufreq_add_dev (struct sys_d
ret = cpufreq_driver->init(policy);
if (ret) {
dprintk("initialization failed\n");
+ mutex_unlock(&policy->lock);
goto err_out;
}

@@ -623,9 +624,10 @@ static int cpufreq_add_dev (struct sys_d
strlcpy(policy->kobj.name, "cpufreq", KOBJ_NAME_LEN);

ret = kobject_register(&policy->kobj);
- if (ret)
+ if (ret) {
+ mutex_unlock(&policy->lock);
goto err_out_driver_exit;
-
+ }
/* set up files for this cpu device */
drv_attr = cpufreq_driver->attr;
while ((drv_attr) && (*drv_attr)) {
_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/