From 1d18ea76ac0fabb19683f61107dbd4d08fe93209 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 25 Jan 2010 15:00:50 +0100 Subject: [PATCH] --- yaml --- r: 179946 b: refs/heads/master c: c453615f77aa51593c1c9c9031b4278797d3fd19 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/hwmon/fschmd.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 5ecfd55bd157..08ad8ca7835a 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5542482b9c61c2588f1178f315310a794988051a +refs/heads/master: c453615f77aa51593c1c9c9031b4278797d3fd19 diff --git a/trunk/drivers/hwmon/fschmd.c b/trunk/drivers/hwmon/fschmd.c index bd0fc67e804b..fa0728232e71 100644 --- a/trunk/drivers/hwmon/fschmd.c +++ b/trunk/drivers/hwmon/fschmd.c @@ -768,6 +768,7 @@ static int watchdog_stop(struct fschmd_data *data) static int watchdog_open(struct inode *inode, struct file *filp) { struct fschmd_data *pos, *data = NULL; + int watchdog_is_open; /* We get called from drivers/char/misc.c with misc_mtx hold, and we call misc_register() from fschmd_probe() with watchdog_data_mutex @@ -782,10 +783,12 @@ static int watchdog_open(struct inode *inode, struct file *filp) } } /* Note we can never not have found data, so we don't check for this */ - kref_get(&data->kref); + watchdog_is_open = test_and_set_bit(0, &data->watchdog_is_open); + if (!watchdog_is_open) + kref_get(&data->kref); mutex_unlock(&watchdog_data_mutex); - if (test_and_set_bit(0, &data->watchdog_is_open)) + if (watchdog_is_open) return -EBUSY; /* Start the watchdog */