Re: [PATCH] iommu/mediatek: fix NULL pointer dereference when printing dev_name

From: Miles Chen
Date: Sun Apr 24 2022 - 19:29:00 EST

>Hi Miles,
>Thank you for the patch! Perhaps something to improve:
>[auto build test WARNING on joro-iommu/next]
>[also build test WARNING on v5.18-rc3 next-20220422]
>[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
>base: next
>config: hexagon-randconfig-r041-20220422 (
>compiler: clang version 15.0.0 ( 5bd87350a5ae429baf8f373cb226a57b62f87280)
>reproduce (this is a W=1 build):
> wget -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> #
> git remote add linux-review
> git fetch --no-tags linux-review Miles-Chen/iommu-mediatek-fix-NULL-pointer-dereference-when-printing-dev_name/20220423-070605
> git checkout 85771767e503ca60069fe4e6ec2ddb80c7f9bafa
> # 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=hexagon SHELL=/bin/bash drivers/iommu/
>If you fix the issue, kindly add following tag as appropriate
>Reported-by: kernel test robot <lkp@xxxxxxxxx>
>All warnings (new ones prefixed by >>):
>>> drivers/iommu/mtk_iommu.c:605:6: warning: variable 'larbdev' is uninitialized when used here [-Wuninitialized]
> if (larbdev) {
> ^~~~~~~
> drivers/iommu/mtk_iommu.c:597:24: note: initialize the variable 'larbdev' to silence this warning
> struct device *larbdev;
> ^
> = NULL
> 1 warning generated.

Thanks for catching this, I will fix this in next version.