]> git.itanic.dy.fi Git - linux-stable/commitdiff
block/iocost: silence warning on 'last_period' potentially being unused
authorJens Axboe <axboe@kernel.dk>
Wed, 10 Jan 2024 15:29:53 +0000 (08:29 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 10 Jan 2024 15:43:06 +0000 (08:43 -0700)
If CONFIG_TRACEPOINTS isn't enabled, we assign this variable but then
never use it. This can cause the compiler to complain about that:

block/blk-iocost.c:1264:6: warning: variable 'last_period' set but not used [-Wunused-but-set-variable]
 1264 |         u64 last_period, cur_period;
      |             ^

Rather than add ifdefs to guard this, just mark it __maybe_unused.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202401102335.GiWdeIo9-lkp@intel.com/
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-iocost.c

index 089fcb9cfce37011f4cf6ec1f86ba36853fed381..c8beec6d7df0863bb4811c12f5ff576e7a5121c7 100644 (file)
@@ -1261,7 +1261,7 @@ static void weight_updated(struct ioc_gq *iocg, struct ioc_now *now)
 static bool iocg_activate(struct ioc_gq *iocg, struct ioc_now *now)
 {
        struct ioc *ioc = iocg->ioc;
-       u64 last_period, cur_period;
+       u64 __maybe_unused last_period, cur_period;
        u64 vtime, vtarget;
        int i;