From: Leon Romanovsky <leon@kernel.org>
To: kernel test robot <lkp@intel.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: Re: [PATCH v1 1/2] dma-mapping: prepare dma_map_ops to conversion to physical address
Date: Sun, 20 Jul 2025 16:10:08 +0300 [thread overview]
Message-ID: <20250720131008.GJ402218@unreal> (raw)
In-Reply-To: <202507201935.hwB4Ebxp-lkp@intel.com>
On Sun, Jul 20, 2025 at 07:28:05PM +0800, kernel test robot wrote:
> Hi Leon,
>
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on next-20250718]
> [cannot apply to linus/master v6.16-rc6 v6.16-rc5 v6.16-rc4 v6.16-rc6]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Leon-Romanovsky/dma-mapping-prepare-dma_map_ops-to-conversion-to-physical-address/20250720-173726
> base: next-20250718
> patch link: https://lore.kernel.org/r/184fc9bda626efc62c5022ace01a20b80d1dc93b.1753003879.git.leon%40kernel.org
> patch subject: [PATCH v1 1/2] dma-mapping: prepare dma_map_ops to conversion to physical address
> config: s390-randconfig-001-20250720 (https://download.01.org/0day-ci/archive/20250720/202507201935.hwB4Ebxp-lkp@intel.com/config)
> compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project 16534d19bf50bde879a83f0ae62875e2c5120e64)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250720/202507201935.hwB4Ebxp-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202507201935.hwB4Ebxp-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> >> kernel/dma/mapping.c:192:12: warning: variable 'addr' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
> 192 | else if (ops->map_page)
> | ^~~~~~~~~~~~~
> kernel/dma/mapping.c:198:32: note: uninitialized use occurs here
> 198 | trace_dma_map_phys(dev, phys, addr, size, dir, attrs);
> | ^~~~
> kernel/dma/mapping.c:192:8: note: remove the 'if' if its condition is always true
> 192 | else if (ops->map_page)
> | ^~~~~~~~~~~~~~~~~~
> 193 | addr = ops->map_page(dev, page, offset, size, dir,
> kernel/dma/mapping.c:159:17: note: initialize the variable 'addr' to silence this warning
> 159 | dma_addr_t addr;
> | ^
> | = 0
> 1 warning generated.
Strange, I didn't get any warning about it for v1.
Thanks
>
>
> vim +192 kernel/dma/mapping.c
>
> 154
> 155 dma_addr_t dma_map_phys(struct device *dev, phys_addr_t phys, size_t size,
> 156 enum dma_data_direction dir, unsigned long attrs)
> 157 {
> 158 const struct dma_map_ops *ops = get_dma_ops(dev);
> 159 dma_addr_t addr;
> 160
> 161 BUG_ON(!valid_dma_direction(dir));
> 162
> 163 if (WARN_ON_ONCE(!dev->dma_mask))
> 164 return DMA_MAPPING_ERROR;
> 165
> 166 if (dma_map_direct(dev, ops) ||
> 167 arch_dma_map_phys_direct(dev, phys + size))
> 168 addr = dma_direct_map_phys(dev, phys, size, dir, attrs);
> 169 else if (use_dma_iommu(dev))
> 170 addr = iommu_dma_map_phys(dev, phys, size, dir, attrs);
> 171 else {
> 172 struct page *page = phys_to_page(phys);
> 173 size_t offset = offset_in_page(phys);
> 174 bool is_pfn_valid = true;
> 175
> 176 if (IS_ENABLED(CONFIG_DMA_API_DEBUG)) {
> 177 is_pfn_valid = pfn_valid(PHYS_PFN(phys));
> 178
> 179 /* We shouldn't have both functions */
> 180 WARN_ON_ONCE(ops->map_page && ops->map_phys);
> 181 }
> 182
> 183 if (unlikely(!is_pfn_valid))
> 184 return DMA_MAPPING_ERROR;
> 185
> 186 /*
> 187 * All platforms which implement .map_page() don't support
> 188 * non-struct page backed addresses.
> 189 */
> 190 if (ops->map_phys)
> 191 addr = ops->map_phys(dev, phys, size, dir, attrs);
> > 192 else if (ops->map_page)
> 193 addr = ops->map_page(dev, page, offset, size, dir,
> 194 attrs);
> 195 }
> 196
> 197 kmsan_handle_dma(phys, size, dir);
> 198 trace_dma_map_phys(dev, phys, addr, size, dir, attrs);
> 199 debug_dma_map_phys(dev, phys, size, dir, addr, attrs);
> 200
> 201 return addr;
> 202 }
> 203 EXPORT_SYMBOL_GPL(dma_map_phys);
> 204
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
prev parent reply other threads:[~2025-07-20 13:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <184fc9bda626efc62c5022ace01a20b80d1dc93b.1753003879.git.leon@kernel.org>
2025-07-20 11:28 ` [PATCH v1 1/2] dma-mapping: prepare dma_map_ops to conversion to physical address kernel test robot
2025-07-20 13:10 ` Leon Romanovsky [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250720131008.GJ402218@unreal \
--to=leon@kernel.org \
--cc=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox