From: Mikulas Patocka Date: Mon, 8 Aug 2022 14:50:10 +0000 (-0400) Subject: dm writecache: fix smatch warning about invalid return from writecache_map X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=b7f362d6413ebd0167ac5a9f09ad5dca5490ac1a;p=linux.git 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: df699cc16ea5e ("dm writecache: report invalid return from writecache_map helpers") Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer --- diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c index ead008ea38f2f..03fe2c5d5e32c 100644 --- a/drivers/md/dm-writecache.c +++ b/drivers/md/dm-writecache.c @@ -1598,7 +1598,8 @@ done: default: BUG(); - return -1; + wc_unlock(wc); + return DM_MAPIO_KILL; } }