]> Git Repo - J-linux.git/commitdiff
dm writecache: fix smatch warning about invalid return from writecache_map
authorMikulas Patocka <[email protected]>
Mon, 8 Aug 2022 14:50:10 +0000 (10:50 -0400)
committerMike Snitzer <[email protected]>
Tue, 9 Aug 2022 23:20:23 +0000 (19:20 -0400)
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 <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Mikulas Patocka <[email protected]>
Signed-off-by: Mike Snitzer <[email protected]>
drivers/md/dm-writecache.c

index ead008ea38f2fc52c53b82685056a5e66302cb55..03fe2c5d5e32c08e9b0d6d9c8734d7542fc67848 100644 (file)
@@ -1598,7 +1598,8 @@ done:
 
        default:
                BUG();
-               return -1;
+               wc_unlock(wc);
+               return DM_MAPIO_KILL;
        }
 }
 
This page took 0.051879 seconds and 4 git commands to generate.