]> git.baikalelectronics.ru Git - kernel.git/commit
blk-mq: silence false positive warnings in hctx_unlock()
authorJens Axboe <axboe@kernel.dk>
Tue, 9 Jan 2018 16:32:25 +0000 (09:32 -0700)
committerJens Axboe <axboe@kernel.dk>
Tue, 9 Jan 2018 16:32:25 +0000 (09:32 -0700)
commit62782847c20daaa1c20c90d603ed639e37cf95fb
treee2c4716d3299defea72a82eac1c6e19847739f69
parentb5b0970e76eff98aa938556bb1ce665f04aa3ffa
blk-mq: silence false positive warnings in hctx_unlock()

In some stupider versions of gcc, it complains:

block/blk-mq.c: In function ‘blk_mq_complete_request’:
./include/linux/srcu.h:175:2: warning: ‘srcu_idx’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  __srcu_read_unlock(sp, idx);
  ^
block/blk-mq.c:620:6: note: ‘srcu_idx’ was declared here
  int srcu_idx;
      ^

which is completely bogus, since we only use srcu_idx when
hctx->flags & BLK_MQ_F_BLOCKING is set, and that's the case where
hctx_lock() has initialized it.

Just set it to '0' in the normal path in hctx_lock() to silence
this annoying warning.

Fixes: 7deaa3f70559 ("blk-mq: move hctx lock/unlock into a helper")
Fixes: 825b1bb00081 ("blk-mq: protect completion path with RCU")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c