Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 130435
b: refs/heads/master
c: 36b477d
h: refs/heads/master
i:
  130433: 2c2c303
  130431: bc30172
v: v3
  • Loading branch information
Artem Bityutskiy authored and Artem Bityutskiy committed Jan 20, 2009
1 parent 3537bae commit 3f61c92
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8c4c19f1367435afdc16ac122a2a95a4d6cff9f0
refs/heads/master: 36b477d005fbda29e7581c3cef7ee31a59d8970b
16 changes: 13 additions & 3 deletions trunk/drivers/mtd/ubi/build.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,12 @@ static ssize_t dev_attribute_show(struct device *dev,
return ret;
}

/* Fake "release" method for UBI devices */
static void dev_release(struct device *dev) { }
static void dev_release(struct device *dev)
{
struct ubi_device *ubi = container_of(dev, struct ubi_device, dev);

kfree(ubi);
}

/**
* ubi_sysfs_init - initialize sysfs for an UBI device.
Expand Down Expand Up @@ -944,6 +948,12 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway)
if (ubi->bgt_thread)
kthread_stop(ubi->bgt_thread);

/*
* Get a reference to the device in order to prevent 'dev_release()'
* from freeing @ubi object.
*/
get_device(&ubi->dev);

uif_close(ubi);
ubi_wl_close(ubi);
free_internal_volumes(ubi);
Expand All @@ -955,7 +965,7 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway)
vfree(ubi->dbg_peb_buf);
#endif
ubi_msg("mtd%d is detached from ubi%d", ubi->mtd->index, ubi->ubi_num);
kfree(ubi);
put_device(&ubi->dev);
return 0;
}

Expand Down

0 comments on commit 3f61c92

Please sign in to comment.