summaryrefslogtreecommitdiffstats
path: root/block/badblocks.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2016-01-06 12:03:41 -0800
committerDan Williams <dan.j.williams@intel.com>2016-01-09 08:39:04 -0800
commit20a308f09e0d29ce6f5a4114cc476a998d569bfb (patch)
tree9a367827e11bb0960c975421a2579cb88db09e33 /block/badblocks.c
parentd3b407fb3f782bd915db64e266010ea30a2d381e (diff)
downloadlinux-stable-20a308f09e0d29ce6f5a4114cc476a998d569bfb.tar.gz
linux-stable-20a308f09e0d29ce6f5a4114cc476a998d569bfb.tar.bz2
linux-stable-20a308f09e0d29ce6f5a4114cc476a998d569bfb.zip
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: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'block/badblocks.c')
-rw-r--r--block/badblocks.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/block/badblocks.c b/block/badblocks.c
index fabf6b64c2d1..37e5c0a2ef69 100644
--- a/block/badblocks.c
+++ b/block/badblocks.c
@@ -555,6 +555,8 @@ EXPORT_SYMBOL_GPL(badblocks_init);
*/
void badblocks_exit(struct badblocks *bb)
{
+ if (!bb)
+ return;
kfree(bb->page);
bb->page = NULL;
}