dynamic mtd_blktrans_dev not fully init'd under UBI?

David Woodhouse dwmw2 at infradead.org
Sat Dec 1 04:28:11 EST 2007


On Fri, 2007-11-30 at 14:58 -0600, catboat at texas.net wrote:
> In the newest git, I see a mutex named "lock" instead, but 
> I don't think it's initialized either. See the function 
> mtdblock_add_mtd() in drivers/mtd/mtdblock.c. The struct
> mtd_blktrans_dev is just kzalloc'd leaving the mutex lock
> all zeroes. 

diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 74d9d30..839eed8 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -248,9 +248,9 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
 		return -EBUSY;
 	}
 
-	mutex_init(&new->lock);
 	list_add_tail(&new->list, &tr->devs);
  added:
+	mutex_init(&new->lock);
 	if (!tr->writesect)
 		new->readonly = 1;
 

-- 
dwmw2




More information about the linux-mtd mailing list