Skip to content

Commit 9ff00d5

Browse files
committed
Merge tag 'for-linus-3.4-20120513' of git://git.infradead.org/linux-mtd
Pull three MTD fixes from David Woodhouse: - Fix a lock ordering deadlock in JFFS2 - Fix an oops in the dataflash driver, triggered by a dummy call to test whether it has OTP functionality. - Fix request_mem_region() failure on amsdelta NAND driver. * tag 'for-linus-3.4-20120513' of git://git.infradead.org/linux-mtd: mtd: ams-delta: fix request_mem_region() failure jffs2: Fix lock acquisition order bug in gc path mtd: fix oops in dataflash driver
2 parents 36be505 + b027274 commit 9ff00d5

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

drivers/mtd/mtdchar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ static int otp_select_filemode(struct mtd_file_info *mfi, int mode)
376376
* Make a fake call to mtd_read_fact_prot_reg() to check if OTP
377377
* operations are supported.
378378
*/
379-
if (mtd_read_fact_prot_reg(mtd, -1, -1, &retlen, NULL) == -EOPNOTSUPP)
379+
if (mtd_read_fact_prot_reg(mtd, -1, 0, &retlen, NULL) == -EOPNOTSUPP)
380380
return -EOPNOTSUPP;
381381

382382
switch (mode) {

drivers/mtd/nand/ams-delta.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -212,18 +212,17 @@ static int __devinit ams_delta_init(struct platform_device *pdev)
212212
/* Link the private data with the MTD structure */
213213
ams_delta_mtd->priv = this;
214214

215-
if (!request_mem_region(res->start, resource_size(res),
216-
dev_name(&pdev->dev))) {
217-
dev_err(&pdev->dev, "request_mem_region failed\n");
218-
err = -EBUSY;
219-
goto out_free;
220-
}
215+
/*
216+
* Don't try to request the memory region from here,
217+
* it should have been already requested from the
218+
* gpio-omap driver and requesting it again would fail.
219+
*/
221220

222221
io_base = ioremap(res->start, resource_size(res));
223222
if (io_base == NULL) {
224223
dev_err(&pdev->dev, "ioremap failed\n");
225224
err = -EIO;
226-
goto out_release_io;
225+
goto out_free;
227226
}
228227

229228
this->priv = io_base;
@@ -271,8 +270,6 @@ static int __devinit ams_delta_init(struct platform_device *pdev)
271270
platform_set_drvdata(pdev, NULL);
272271
gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB);
273272
iounmap(io_base);
274-
out_release_io:
275-
release_mem_region(res->start, resource_size(res));
276273
out_free:
277274
kfree(ams_delta_mtd);
278275
out:
@@ -285,15 +282,13 @@ static int __devinit ams_delta_init(struct platform_device *pdev)
285282
static int __devexit ams_delta_cleanup(struct platform_device *pdev)
286283
{
287284
void __iomem *io_base = platform_get_drvdata(pdev);
288-
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
289285

290286
/* Release resources, unregister device */
291287
nand_release(ams_delta_mtd);
292288

293289
gpio_free_array(_mandatory_gpio, ARRAY_SIZE(_mandatory_gpio));
294290
gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB);
295291
iounmap(io_base);
296-
release_mem_region(res->start, resource_size(res));
297292

298293
/* Free the MTD device structure */
299294
kfree(ams_delta_mtd);

fs/jffs2/gc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
234234
return 0;
235235

236236
jffs2_dbg(1, "No progress from erasing block; doing GC anyway\n");
237-
spin_lock(&c->erase_completion_lock);
238237
mutex_lock(&c->alloc_sem);
238+
spin_lock(&c->erase_completion_lock);
239239
}
240240

241241
/* First, work out which block we're garbage-collecting */

0 commit comments

Comments
 (0)