Skip to content

Commit

Permalink
dm writecache: fix unnecessary NULL check warnings
Browse files Browse the repository at this point in the history
Remove NULL checks before vfree() to fix these warnings:
./drivers/md/dm-writecache.c:2008:2-7: WARNING: NULL check before some
freeing functions is not needed.
./drivers/md/dm-writecache.c:2024:2-7: WARNING: NULL check before some
freeing functions is not needed.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
  • Loading branch information
Tian Tao authored and Mike Snitzer committed Feb 3, 2021
1 parent cb72848 commit 21ec672
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/md/dm-writecache.c
Original file line number Diff line number Diff line change
Expand Up @@ -2004,8 +2004,7 @@ static void writecache_dtr(struct dm_target *ti)
if (wc->ssd_dev)
dm_put_device(ti, wc->ssd_dev);

if (wc->entries)
vfree(wc->entries);
vfree(wc->entries);

if (wc->memory_map) {
if (WC_MODE_PMEM(wc))
Expand All @@ -2020,8 +2019,7 @@ static void writecache_dtr(struct dm_target *ti)
if (wc->dm_io)
dm_io_client_destroy(wc->dm_io);

if (wc->dirty_bitmap)
vfree(wc->dirty_bitmap);
vfree(wc->dirty_bitmap);

kfree(wc);
}
Expand Down

0 comments on commit 21ec672

Please sign in to comment.