drm/amd/powerplay: Use memset to initialize metrics structs
clang warns: drivers/gpu/drm/amd/amdgpu/../powerplay/navi10_ppt.c:601:33: warning: suggest braces around initialization of subobject [-Wmissing-braces] static SmuMetrics_t metrics = {0}; ^ {} drivers/gpu/drm/amd/amdgpu/../powerplay/navi10_ppt.c:905:26: warning: suggest braces around initialization of subobject [-Wmissing-braces] SmuMetrics_t metrics = {0}; ^ {} 2 warnings generated. One way to fix these warnings is to add additional braces like clang suggests; however, there has been a bit of push back from some maintainers[1][2], who just prefer memset as it is unambiguous, doesn't depend on a particular compiler version[3], and properly initializes all subobjects. Do that here so there are no more warnings. [1]: https://lore.kernel.org/lkml/022e41c0-8465-dc7a-a45c-64187ecd9684@amd.com/ [2]: https://lore.kernel.org/lkml/20181128.215241.702406654469517539.davem@davemloft.net/ [3]: https://lore.kernel.org/lkml/20181116150432.2408a075@redhat.com/ Fixes:98e1a543c7
("drm/amd/powerplay: add function get current clock freq interface for navi10") Fixes:ab43c4bf1c
("drm/amd/powerplay: fix fan speed show error (for hwmon pwm)") Link: https://github.com/ClangBuiltLinux/linux/issues/583 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
f19367da96
commit
d693e8e349
@ -606,12 +606,14 @@ static int navi10_get_current_clk_freq_by_table(struct smu_context *smu,
|
||||
enum smu_clk_type clk_type,
|
||||
uint32_t *value)
|
||||
{
|
||||
static SmuMetrics_t metrics = {0};
|
||||
static SmuMetrics_t metrics;
|
||||
int ret = 0, clk_id = 0;
|
||||
|
||||
if (!value)
|
||||
return -EINVAL;
|
||||
|
||||
memset(&metrics, 0, sizeof(metrics));
|
||||
|
||||
ret = smu_update_table(smu, SMU_TABLE_SMU_METRICS, (void *)&metrics, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
@ -910,12 +912,14 @@ static bool navi10_is_dpm_running(struct smu_context *smu)
|
||||
|
||||
static int navi10_get_fan_speed(struct smu_context *smu, uint16_t *value)
|
||||
{
|
||||
SmuMetrics_t metrics = {0};
|
||||
SmuMetrics_t metrics;
|
||||
int ret = 0;
|
||||
|
||||
if (!value)
|
||||
return -EINVAL;
|
||||
|
||||
memset(&metrics, 0, sizeof(metrics));
|
||||
|
||||
ret = smu_update_table(smu, SMU_TABLE_SMU_METRICS,
|
||||
(void *)&metrics, false);
|
||||
if (ret)
|
||||
|
Loading…
Reference in New Issue
Block a user