Skip to content

Commit b7f362d

Browse files
Mikulas PatockaMike Snitzer
authored andcommitted
dm writecache: fix smatch warning about invalid return from writecache_map
There's a smatch warning "inconsistent returns '&wc->lock'" in dm-writecache. The reason for the warning is that writecache_map() doesn't drop the lock on the impossible path. Fix this warning by adding wc_unlock() after the BUG statement (so that it will be compiled-away anyway). Fixes: df699cc ("dm writecache: report invalid return from writecache_map helpers") Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
1 parent f876df9 commit b7f362d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/md/dm-writecache.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1598,7 +1598,8 @@ static int writecache_map(struct dm_target *ti, struct bio *bio)
15981598

15991599
default:
16001600
BUG();
1601-
return -1;
1601+
wc_unlock(wc);
1602+
return DM_MAPIO_KILL;
16021603
}
16031604
}
16041605

0 commit comments

Comments
 (0)