drm/radeon/kms: add dpm support for KB/KV

Dan Carpenter dan.carpenter at oracle.com
Tue May 3 18:53:38 UTC 2016


Hello Alex Deucher,

The patch 41a524abff26: "drm/radeon/kms: add dpm support for KB/KV"
from Aug 14, 2013, leads to the following static checker warning:

	drivers/gpu/drm/radeon/kv_dpm.c:1376 kv_init_fps_limits()
	error: wrong number of bits for 'cpu_to_be16' (8 vs 16) left= 'pi->fps_low_t' pi->fps_low_t = (__builtin_bswap16(((tmp))))

drivers/gpu/drm/radeon/kv_dpm.c
  1359  static int kv_init_fps_limits(struct radeon_device *rdev)
  1360  {
  1361          struct kv_power_info *pi = kv_get_pi(rdev);
  1362          int ret = 0;
  1363  
  1364          if (pi->caps_fps) {
  1365                  u16 tmp;
  1366  
  1367                  tmp = 45;
  1368                  pi->fps_high_t = cpu_to_be16(tmp);
  1369                  ret = kv_copy_bytes_to_smc(rdev,
  1370                                             pi->dpm_table_start +
  1371                                             offsetof(SMU7_Fusion_DpmTable, FpsHighT),
  1372                                             (u8 *)&pi->fps_high_t,
  1373                                             sizeof(u16), pi->sram_end);
  1374  
  1375                  tmp = 30;
  1376                  pi->fps_low_t = cpu_to_be16(tmp);
                        ^^^^^^^^^^^^^
This is a u8 so it can't hold a be16.

  1377  
  1378                  ret = kv_copy_bytes_to_smc(rdev,
  1379                                             pi->dpm_table_start +
  1380                                             offsetof(SMU7_Fusion_DpmTable, FpsLowT),
  1381                                             (u8 *)&pi->fps_low_t,
                                                   ^^^^^^
This cast is not needed since it's already a u8 pointer.

  1382                                             sizeof(u16), pi->sram_end);
  1383  
  1384          }
  1385          return ret;
  1386  }

regards,
dan carpenter


More information about the dri-devel mailing list