Merge branch 'drm-next-5.1' of git://people.freedesktop.org/~agd5f/linux into drm...
[linux-2.6-microblaze.git] / drivers / gpu / drm / amd / powerplay / hwmgr / smu10_hwmgr.c
index 5273de3..0ad8fe4 100644 (file)
@@ -139,12 +139,10 @@ static int smu10_construct_max_power_limits_table(struct pp_hwmgr *hwmgr,
 static int smu10_init_dynamic_state_adjustment_rule_settings(
                                                        struct pp_hwmgr *hwmgr)
 {
-       uint32_t table_size =
-               sizeof(struct phm_clock_voltage_dependency_table) +
-               (7 * sizeof(struct phm_clock_voltage_dependency_record));
+       struct phm_clock_voltage_dependency_table *table_clk_vlt;
 
-       struct phm_clock_voltage_dependency_table *table_clk_vlt =
-                                       kzalloc(table_size, GFP_KERNEL);
+       table_clk_vlt = kzalloc(struct_size(table_clk_vlt, entries, 7),
+                               GFP_KERNEL);
 
        if (NULL == table_clk_vlt) {
                pr_err("Can not allocate memory!\n");