[drm-misc:for-linux-next 1/1] drivers/gpu/drm/msm/msm_fbdev.c:144:6: warning: variable 'helper' is used uninitialized whenever 'if' condition is true

kernel test robot lkp at intel.com
Wed Feb 22 00:33:10 UTC 2023


tree:   git://anongit.freedesktop.org/drm/drm-misc for-linux-next
head:   3fb1f62f80a1d249260db5ea9e22c51e52fab9ae
commit: 3fb1f62f80a1d249260db5ea9e22c51e52fab9ae [1/1] drm/fb-helper: Remove drm_fb_helper_unprepare() from drm_fb_helper_fini()
config: arm-buildonly-randconfig-r004-20230219 (https://download.01.org/0day-ci/archive/20230222/202302220810.9dymwCQ8-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project db89896bbbd2251fff457699635acbbedeead27f)
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 arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        git remote add drm-misc git://anongit.freedesktop.org/drm/drm-misc
        git fetch --no-tags drm-misc for-linux-next
        git checkout 3fb1f62f80a1d249260db5ea9e22c51e52fab9ae
        # 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=arm olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/gpu/drm/msm/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp at intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202302220810.9dymwCQ8-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/msm/msm_fbdev.c:144:6: warning: variable 'helper' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (!fbdev)
               ^~~~~~
   drivers/gpu/drm/msm/msm_fbdev.c:173:26: note: uninitialized use occurs here
           drm_fb_helper_unprepare(helper);
                                   ^~~~~~
   drivers/gpu/drm/msm/msm_fbdev.c:144:2: note: remove the 'if' if its condition is always false
           if (!fbdev)
           ^~~~~~~~~~~
   drivers/gpu/drm/msm/msm_fbdev.c:140:30: note: initialize the variable 'helper' to silence this warning
           struct drm_fb_helper *helper;
                                       ^
                                        = NULL
   1 warning generated.


vim +144 drivers/gpu/drm/msm/msm_fbdev.c

c8afe684c95cd17 Rob Clark         2013-06-26  134  
c8afe684c95cd17 Rob Clark         2013-06-26  135  /* initialize fbdev helper */
c8afe684c95cd17 Rob Clark         2013-06-26  136  struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev)
c8afe684c95cd17 Rob Clark         2013-06-26  137  {
c8afe684c95cd17 Rob Clark         2013-06-26  138  	struct msm_drm_private *priv = dev->dev_private;
c8afe684c95cd17 Rob Clark         2013-06-26  139  	struct msm_fbdev *fbdev = NULL;
c8afe684c95cd17 Rob Clark         2013-06-26  140  	struct drm_fb_helper *helper;
8f67da335d08bc0 Hai Li            2014-06-18  141  	int ret;
c8afe684c95cd17 Rob Clark         2013-06-26  142  
c8afe684c95cd17 Rob Clark         2013-06-26  143  	fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL);
c8afe684c95cd17 Rob Clark         2013-06-26 @144  	if (!fbdev)
c8afe684c95cd17 Rob Clark         2013-06-26  145  		goto fail;
c8afe684c95cd17 Rob Clark         2013-06-26  146  
c8afe684c95cd17 Rob Clark         2013-06-26  147  	helper = &fbdev->base;
c8afe684c95cd17 Rob Clark         2013-06-26  148  
6c80a93be62d398 Thomas Zimmermann 2023-01-25  149  	drm_fb_helper_prepare(dev, helper, 32, &msm_fb_helper_funcs);
c8afe684c95cd17 Rob Clark         2013-06-26  150  
2dea2d1182179e7 Pankaj Bharadiya  2020-03-05  151  	ret = drm_fb_helper_init(dev, helper);
c8afe684c95cd17 Rob Clark         2013-06-26  152  	if (ret) {
6a41da17e87dee2 Mamta Shukla      2018-10-20  153  		DRM_DEV_ERROR(dev->dev, "could not init fbdev: ret=%d\n", ret);
c8afe684c95cd17 Rob Clark         2013-06-26  154  		goto fail;
c8afe684c95cd17 Rob Clark         2013-06-26  155  	}
c8afe684c95cd17 Rob Clark         2013-06-26  156  
23c259722d0eddf Jeffrey Hugo      2019-06-28  157  	/* the fw fb could be anywhere in memory */
97c9bfe3f6605d4 Thomas Zimmermann 2021-06-29  158  	ret = drm_aperture_remove_framebuffers(false, dev->driver);
6848c291a54f8cd Thomas Zimmermann 2021-04-12  159  	if (ret)
6848c291a54f8cd Thomas Zimmermann 2021-04-12  160  		goto fini;
23c259722d0eddf Jeffrey Hugo      2019-06-28  161  
6c80a93be62d398 Thomas Zimmermann 2023-01-25  162  	ret = drm_fb_helper_initial_config(helper);
01934c2a6918821 Thierry Reding    2014-12-19  163  	if (ret)
01934c2a6918821 Thierry Reding    2014-12-19  164  		goto fini;
c8afe684c95cd17 Rob Clark         2013-06-26  165  
c8afe684c95cd17 Rob Clark         2013-06-26  166  	priv->fbdev = helper;
c8afe684c95cd17 Rob Clark         2013-06-26  167  
c8afe684c95cd17 Rob Clark         2013-06-26  168  	return helper;
c8afe684c95cd17 Rob Clark         2013-06-26  169  
01934c2a6918821 Thierry Reding    2014-12-19  170  fini:
01934c2a6918821 Thierry Reding    2014-12-19  171  	drm_fb_helper_fini(helper);
c8afe684c95cd17 Rob Clark         2013-06-26  172  fail:
3fb1f62f80a1d24 Thomas Zimmermann 2023-02-16  173  	drm_fb_helper_unprepare(helper);
c8afe684c95cd17 Rob Clark         2013-06-26  174  	kfree(fbdev);
c8afe684c95cd17 Rob Clark         2013-06-26  175  	return NULL;
c8afe684c95cd17 Rob Clark         2013-06-26  176  }
c8afe684c95cd17 Rob Clark         2013-06-26  177  

:::::: The code at line 144 was first introduced by commit
:::::: c8afe684c95cd17cf4f273d81af369a0fdfa5a74 drm/msm: basic KMS driver for snapdragon

:::::: TO: Rob Clark <robdclark at gmail.com>
:::::: CC: Rob Clark <robdclark at gmail.com>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests


More information about the dri-devel mailing list