The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] mmc_test: initialize mmc_test_lock statically
@ 2008-09-13 10:03 Akinobu Mita
  2008-09-20 11:03 ` Pierre Ossman
  0 siblings, 1 reply; 2+ messages in thread
From: Akinobu Mita @ 2008-09-13 10:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: Pierre Ossman

The mutex mmc_test_lock is initialized at every time mmc_test device
is probed. Probing another mmc_test device may break the mutex, if
the probe function is called while the mutex is locked.

This patch fixes it by statically initializing mmc_test_lock.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Pierre Ossman <drzeus-mmc@drzeus.cx>
---
 drivers/mmc/card/mmc_test.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Index: 2.6-git/drivers/mmc/card/mmc_test.c
===================================================================
--- 2.6-git.orig/drivers/mmc/card/mmc_test.c
+++ 2.6-git/drivers/mmc/card/mmc_test.c
@@ -1040,7 +1040,7 @@ static const struct mmc_test_case mmc_te
 
 };
 
-static struct mutex mmc_test_lock;
+static DEFINE_MUTEX(mmc_test_lock);
 
 static void mmc_test_run(struct mmc_test_card *test, int testcase)
 {
@@ -1171,8 +1171,6 @@ static int mmc_test_probe(struct mmc_car
 	if ((card->type != MMC_TYPE_MMC) && (card->type != MMC_TYPE_SD))
 		return -ENODEV;
 
-	mutex_init(&mmc_test_lock);
-
 	ret = device_create_file(&card->dev, &dev_attr_test);
 	if (ret)
 		return ret;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-09-20 11:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-13 10:03 [PATCH] mmc_test: initialize mmc_test_lock statically Akinobu Mita
2008-09-20 11:03 ` Pierre Ossman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox