Skip to content

Commit

Permalink
mmc_test: initialize mmc_test_lock statically
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
  • Loading branch information
Akinobu Mita authored and Pierre Ossman committed Sep 20, 2008
1 parent 9d4e98e commit a650031
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/mmc/card/mmc_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ static const struct mmc_test_case mmc_test_cases[] = {

};

static struct mutex mmc_test_lock;
static DEFINE_MUTEX(mmc_test_lock);

static void mmc_test_run(struct mmc_test_card *test, int testcase)
{
Expand Down Expand Up @@ -1171,8 +1171,6 @@ static int mmc_test_probe(struct mmc_card *card)
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;
Expand Down

0 comments on commit a650031

Please sign in to comment.