From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD853C433F5 for ; Tue, 10 May 2022 00:45:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233876AbiEJAtG (ORCPT ); Mon, 9 May 2022 20:49:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233011AbiEJAtC (ORCPT ); Mon, 9 May 2022 20:49:02 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 110C2201388 for ; Mon, 9 May 2022 17:45:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652143507; x=1683679507; h=date:from:to:cc:subject:message-id:mime-version; bh=GeIgOnwBjoETAQHmucQ7R/kDKLxgAt3Z9vGZ1wlwYj8=; b=c/xi6+ETSAtGAN2uKSkTE3DSij7YnCZB7wCpRpDRUVwxB5wErMgVSmCr Yrwvso6nUPmqk45HuejkLHdbtwcF6XMGHlJpg7zpvKDcjYIxpN4ck2/g5 z5p62kG1G2WJTIfErKG6Cb7JhrtkQJSlL+DdY3YC3EntslOZjRuuPswPs uEVthPALwkpwlLDN7OtTwuAM8BQwJzu//chEiQtkS8MgnAS0hUa8V05wr KE6cbhSmZUZIb+CiXKaazlNl1+OASYjJjWBl8snkpo2jGA8qMMt7SS2Td xTT4C0lq2PUf9sbq+S6fzjvW3Rvmbe4xN+mdfPI4KViarQ4OjGgD6fQXq g==; X-IronPort-AV: E=McAfee;i="6400,9594,10342"; a="269146724" X-IronPort-AV: E=Sophos;i="5.91,212,1647327600"; d="scan'208";a="269146724" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2022 17:45:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,212,1647327600"; d="scan'208";a="657382336" Received: from lkp-server01.sh.intel.com (HELO 5056e131ad90) ([10.239.97.150]) by FMSMGA003.fm.intel.com with ESMTP; 09 May 2022 17:45:04 -0700 Received: from kbuild by 5056e131ad90 with local (Exim 4.95) (envelope-from ) id 1noDzs-000H44-38; Tue, 10 May 2022 00:45:04 +0000 Date: Tue, 10 May 2022 08:44:25 +0800 From: kernel test robot To: Anup Patel Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org, linux-kernel@vger.kernel.org Subject: [avpatel:riscv_kvm_aia_v1 34/35] arch/riscv/kvm/aia_aplic.c:264:6: warning: variable 'inject' is used uninitialized whenever 'if' condition is true Message-ID: <202205100811.BAMM4bPO-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org tree: https://github.com/avpatel/linux.git riscv_kvm_aia_v1 head: 2622f5aa2f4ccb93fdd771e7503ca364c6a290d4 commit: cd81051cd1fc8eeb4629c0f3b71cf570e4a7d436 [34/35] RISC-V: KVM: Add in-kernel emulation of AIA APLIC config: riscv-randconfig-r004-20220509 (https://download.01.org/0day-ci/archive/20220510/202205100811.BAMM4bPO-lkp@intel.com/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project a385645b470e2d3a1534aae618ea56b31177639f) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install riscv cross compiling tool for clang build # apt-get install binutils-riscv64-linux-gnu # https://github.com/avpatel/linux/commit/cd81051cd1fc8eeb4629c0f3b71cf570e4a7d436 git remote add avpatel https://github.com/avpatel/linux.git git fetch --no-tags avpatel riscv_kvm_aia_v1 git checkout cd81051cd1fc8eeb4629c0f3b71cf570e4a7d436 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): >> arch/riscv/kvm/aia_aplic.c:264:6: warning: variable 'inject' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (irqd->sourcecfg & APLIC_SOURCECFG_D) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/kvm/aia_aplic.c:303:6: note: uninitialized use occurs here if (inject) ^~~~~~ arch/riscv/kvm/aia_aplic.c:264:2: note: remove the 'if' if its condition is always false if (irqd->sourcecfg & APLIC_SOURCECFG_D) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/kvm/aia_aplic.c:252:13: note: initialize the variable 'inject' to silence this warning bool inject, ie; ^ = 0 1 warning generated. vim +264 arch/riscv/kvm/aia_aplic.c 248 249 int kvm_riscv_aia_aplic_inject(struct kvm *kvm, u32 source, bool level) 250 { 251 u32 target; 252 bool inject, ie; 253 unsigned long flags; 254 struct aplic_irq *irqd; 255 struct aplic *aplic = kvm->arch.aia.aplic_state; 256 257 if (!aplic || !source || (aplic->nr_irqs <= source)) 258 return -ENODEV; 259 irqd = &aplic->irqs[source]; 260 ie = (aplic->domaincfg & APLIC_DOMAINCFG_IE) ? true : false; 261 262 raw_spin_lock_irqsave(&irqd->lock, flags); 263 > 264 if (irqd->sourcecfg & APLIC_SOURCECFG_D) 265 goto skip_unlock; 266 267 switch (irqd->sourcecfg & APLIC_SOURCECFG_SM_MASK) { 268 case APLIC_SOURCECFG_SM_EDGE_RISE: 269 if (level && !(irqd->state & APLIC_IRQ_STATE_INPUT) && 270 !(irqd->state & APLIC_IRQ_STATE_PENDING)) 271 irqd->state |= APLIC_IRQ_STATE_PENDING; 272 break; 273 case APLIC_SOURCECFG_SM_EDGE_FALL: 274 if (!level && (irqd->state & APLIC_IRQ_STATE_INPUT) && 275 !(irqd->state & APLIC_IRQ_STATE_PENDING)) 276 irqd->state |= APLIC_IRQ_STATE_PENDING; 277 break; 278 case APLIC_SOURCECFG_SM_LEVEL_HIGH: 279 if (level && !(irqd->state & APLIC_IRQ_STATE_PENDING)) 280 irqd->state |= APLIC_IRQ_STATE_PENDING; 281 break; 282 case APLIC_SOURCECFG_SM_LEVEL_LOW: 283 if (!level && !(irqd->state & APLIC_IRQ_STATE_PENDING)) 284 irqd->state |= APLIC_IRQ_STATE_PENDING; 285 break; 286 } 287 288 if (level) 289 irqd->state |= APLIC_IRQ_STATE_INPUT; 290 else 291 irqd->state &= ~APLIC_IRQ_STATE_INPUT; 292 293 inject = false; 294 target = irqd->target; 295 if (ie && (irqd->state & APLIC_IRQ_STATE_ENPEND)) { 296 irqd->state &= ~APLIC_IRQ_STATE_PENDING; 297 inject = true; 298 } 299 300 skip_unlock: 301 raw_spin_unlock_irqrestore(&irqd->lock, flags); 302 303 if (inject) 304 aplic_inject_msi(kvm, source, target); 305 306 return 0; 307 } 308 -- 0-DAY CI Kernel Test Service https://01.org/lkp