Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 20a308f0 authored by Dan Williams's avatar Dan Williams
Browse files

block: clarify badblocks lifetime



The badblocks list attached to a gendisk is allocated by the driver
which equates to the driver owning the lifetime of the object.  Do not
automatically free it in del_gendisk(). This is in preparation for
expanding the use of badblocks in libnvdimm drivers and introducing
devm_init_badblocks().

Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent d3b407fb
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -555,6 +555,8 @@ EXPORT_SYMBOL_GPL(badblocks_init);
 */
void badblocks_exit(struct badblocks *bb)
{
	if (!bb)
		return;
	kfree(bb->page);
	bb->page = NULL;
}
+0 −5
Original line number Diff line number Diff line
@@ -670,11 +670,6 @@ void del_gendisk(struct gendisk *disk)
	blk_unregister_queue(disk);
	blk_unregister_region(disk_devt(disk), disk->minors);

	if (disk->bb) {
		badblocks_exit(disk->bb);
		kfree(disk->bb);
	}

	part_stat_set_all(&disk->part0, 0);
	disk->part0.stamp = 0;