drm/amd/powerplay: add smu support for ellesmere/baffin

Dan Carpenter dan.carpenter at oracle.com
Tue May 10 10:54:26 UTC 2016


Hello rezhu,

The patch c81726252ec9: "drm/amd/powerplay: add smu support for
ellesmere/baffin" from Nov 10, 2015, leads to the following static
checker warning:

	drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/polaris10_smumgr.c:978 polaris10_smum_init()
	warn: returning -1 instead of -ENOMEM is sloppy

drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/polaris10_smumgr.c
   971  int polaris10_smum_init(struct pp_smumgr *smumgr)
   972  {
   973          struct polaris10_smumgr *polaris10_smu = NULL;
                                         ^^^^^^^^^^^^^^^^^^^^
Please remove this.  GCC has a tool for warning about uninitialized
variables.  If we just turn it off by initializing it to a bogus value
then it can let bugs go undetected.

   974  
   975          polaris10_smu = kzalloc(sizeof(struct polaris10_smumgr), GFP_KERNEL);
   976  
   977          if (polaris10_smu == NULL)
   978                  return -1;

return -ENOMEM;

   979  
   980          smumgr->backend = polaris10_smu;
   981          smumgr->smumgr_funcs = &ellsemere_smu_funcs;
   982  
   983          return 0;
   984  }

regards,
dan carpenter


More information about the dri-devel mailing list