diff options
Diffstat (limited to 'drivers/gpu/drm/amd/display')
8 files changed, 44 insertions, 35 deletions
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c index bd449351803f..ec304b1a5973 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | |||
| @@ -435,7 +435,7 @@ bool dm_helpers_submit_i2c( | |||
| 435 | return false; | 435 | return false; |
| 436 | } | 436 | } |
| 437 | 437 | ||
| 438 | msgs = kzalloc(num * sizeof(struct i2c_msg), GFP_KERNEL); | 438 | msgs = kcalloc(num, sizeof(struct i2c_msg), GFP_KERNEL); |
| 439 | 439 | ||
| 440 | if (!msgs) | 440 | if (!msgs) |
| 441 | return false; | 441 | return false; |
diff --git a/drivers/gpu/drm/amd/display/dc/basics/logger.c b/drivers/gpu/drm/amd/display/dc/basics/logger.c index 738a818d58d1..0866874ae8c6 100644 --- a/drivers/gpu/drm/amd/display/dc/basics/logger.c +++ b/drivers/gpu/drm/amd/display/dc/basics/logger.c | |||
| @@ -364,7 +364,7 @@ void dm_logger_open( | |||
| 364 | entry->type = log_type; | 364 | entry->type = log_type; |
| 365 | entry->logger = logger; | 365 | entry->logger = logger; |
| 366 | 366 | ||
| 367 | entry->buf = kzalloc(DAL_LOGGER_BUFFER_MAX_SIZE * sizeof(char), | 367 | entry->buf = kzalloc(DAL_LOGGER_BUFFER_MAX_SIZE, |
| 368 | GFP_KERNEL); | 368 | GFP_KERNEL); |
| 369 | 369 | ||
| 370 | entry->buf_offset = 0; | 370 | entry->buf_offset = 0; |
diff --git a/drivers/gpu/drm/amd/display/dc/basics/vector.c b/drivers/gpu/drm/amd/display/dc/basics/vector.c index 217b8f1f7bf6..d28e9cf0e961 100644 --- a/drivers/gpu/drm/amd/display/dc/basics/vector.c +++ b/drivers/gpu/drm/amd/display/dc/basics/vector.c | |||
| @@ -40,7 +40,7 @@ bool dal_vector_construct( | |||
| 40 | return false; | 40 | return false; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | vector->container = kzalloc(struct_size * capacity, GFP_KERNEL); | 43 | vector->container = kcalloc(capacity, struct_size, GFP_KERNEL); |
| 44 | if (vector->container == NULL) | 44 | if (vector->container == NULL) |
| 45 | return false; | 45 | return false; |
| 46 | vector->capacity = capacity; | 46 | vector->capacity = capacity; |
| @@ -67,7 +67,7 @@ bool dal_vector_presized_costruct( | |||
| 67 | return false; | 67 | return false; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | vector->container = kzalloc(struct_size * count, GFP_KERNEL); | 70 | vector->container = kcalloc(count, struct_size, GFP_KERNEL); |
| 71 | 71 | ||
| 72 | if (vector->container == NULL) | 72 | if (vector->container == NULL) |
| 73 | return false; | 73 | return false; |
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c index 599c7ab6befe..88b09dd758ba 100644 --- a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c | |||
| @@ -1079,13 +1079,15 @@ static void get_ss_info_from_atombios( | |||
| 1079 | if (*ss_entries_num == 0) | 1079 | if (*ss_entries_num == 0) |
| 1080 | return; | 1080 | return; |
| 1081 | 1081 | ||
| 1082 | ss_info = kzalloc(sizeof(struct spread_spectrum_info) * (*ss_entries_num), | 1082 | ss_info = kcalloc(*ss_entries_num, |
| 1083 | sizeof(struct spread_spectrum_info), | ||
| 1083 | GFP_KERNEL); | 1084 | GFP_KERNEL); |
| 1084 | ss_info_cur = ss_info; | 1085 | ss_info_cur = ss_info; |
| 1085 | if (ss_info == NULL) | 1086 | if (ss_info == NULL) |
| 1086 | return; | 1087 | return; |
| 1087 | 1088 | ||
| 1088 | ss_data = kzalloc(sizeof(struct spread_spectrum_data) * (*ss_entries_num), | 1089 | ss_data = kcalloc(*ss_entries_num, |
| 1090 | sizeof(struct spread_spectrum_data), | ||
| 1089 | GFP_KERNEL); | 1091 | GFP_KERNEL); |
| 1090 | if (ss_data == NULL) | 1092 | if (ss_data == NULL) |
| 1091 | goto out_free_info; | 1093 | goto out_free_info; |
diff --git a/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c b/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c index 80038e0e610f..ab5483c0c502 100644 --- a/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c +++ b/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c | |||
| @@ -98,7 +98,8 @@ struct gpio_service *dal_gpio_service_create( | |||
| 98 | if (number_of_bits) { | 98 | if (number_of_bits) { |
| 99 | uint32_t index_of_uint = 0; | 99 | uint32_t index_of_uint = 0; |
| 100 | 100 | ||
| 101 | slot = kzalloc(number_of_uints * sizeof(uint32_t), | 101 | slot = kcalloc(number_of_uints, |
| 102 | sizeof(uint32_t), | ||
| 102 | GFP_KERNEL); | 103 | GFP_KERNEL); |
| 103 | 104 | ||
| 104 | if (!slot) { | 105 | if (!slot) { |
diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c index 0cd111d59018..eee0dfad6962 100644 --- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c +++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c | |||
| @@ -1274,19 +1274,22 @@ bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf, | |||
| 1274 | 1274 | ||
| 1275 | output_tf->type = TF_TYPE_DISTRIBUTED_POINTS; | 1275 | output_tf->type = TF_TYPE_DISTRIBUTED_POINTS; |
| 1276 | 1276 | ||
| 1277 | rgb_user = kvzalloc(sizeof(*rgb_user) * (ramp->num_entries + _EXTRA_POINTS), | 1277 | rgb_user = kvcalloc(ramp->num_entries + _EXTRA_POINTS, |
| 1278 | sizeof(*rgb_user), | ||
| 1278 | GFP_KERNEL); | 1279 | GFP_KERNEL); |
| 1279 | if (!rgb_user) | 1280 | if (!rgb_user) |
| 1280 | goto rgb_user_alloc_fail; | 1281 | goto rgb_user_alloc_fail; |
| 1281 | rgb_regamma = kvzalloc(sizeof(*rgb_regamma) * (MAX_HW_POINTS + _EXTRA_POINTS), | 1282 | rgb_regamma = kvcalloc(MAX_HW_POINTS + _EXTRA_POINTS, |
| 1283 | sizeof(*rgb_regamma), | ||
| 1282 | GFP_KERNEL); | 1284 | GFP_KERNEL); |
| 1283 | if (!rgb_regamma) | 1285 | if (!rgb_regamma) |
| 1284 | goto rgb_regamma_alloc_fail; | 1286 | goto rgb_regamma_alloc_fail; |
| 1285 | axix_x = kvzalloc(sizeof(*axix_x) * (ramp->num_entries + 3), | 1287 | axix_x = kvcalloc(ramp->num_entries + 3, sizeof(*axix_x), |
| 1286 | GFP_KERNEL); | 1288 | GFP_KERNEL); |
| 1287 | if (!axix_x) | 1289 | if (!axix_x) |
| 1288 | goto axix_x_alloc_fail; | 1290 | goto axix_x_alloc_fail; |
| 1289 | coeff = kvzalloc(sizeof(*coeff) * (MAX_HW_POINTS + _EXTRA_POINTS), GFP_KERNEL); | 1291 | coeff = kvcalloc(MAX_HW_POINTS + _EXTRA_POINTS, sizeof(*coeff), |
| 1292 | GFP_KERNEL); | ||
| 1290 | if (!coeff) | 1293 | if (!coeff) |
| 1291 | goto coeff_alloc_fail; | 1294 | goto coeff_alloc_fail; |
| 1292 | 1295 | ||
| @@ -1413,13 +1416,15 @@ bool calculate_user_regamma_ramp(struct dc_transfer_func *output_tf, | |||
| 1413 | 1416 | ||
| 1414 | output_tf->type = TF_TYPE_DISTRIBUTED_POINTS; | 1417 | output_tf->type = TF_TYPE_DISTRIBUTED_POINTS; |
| 1415 | 1418 | ||
| 1416 | rgb_user = kzalloc(sizeof(*rgb_user) * (GAMMA_RGB_256_ENTRIES + _EXTRA_POINTS), | 1419 | rgb_user = kcalloc(GAMMA_RGB_256_ENTRIES + _EXTRA_POINTS, |
| 1417 | GFP_KERNEL); | 1420 | sizeof(*rgb_user), |
| 1421 | GFP_KERNEL); | ||
| 1418 | if (!rgb_user) | 1422 | if (!rgb_user) |
| 1419 | goto rgb_user_alloc_fail; | 1423 | goto rgb_user_alloc_fail; |
| 1420 | 1424 | ||
| 1421 | rgb_regamma = kzalloc(sizeof(*rgb_regamma) * (MAX_HW_POINTS + _EXTRA_POINTS), | 1425 | rgb_regamma = kcalloc(MAX_HW_POINTS + _EXTRA_POINTS, |
| 1422 | GFP_KERNEL); | 1426 | sizeof(*rgb_regamma), |
| 1427 | GFP_KERNEL); | ||
| 1423 | if (!rgb_regamma) | 1428 | if (!rgb_regamma) |
| 1424 | goto rgb_regamma_alloc_fail; | 1429 | goto rgb_regamma_alloc_fail; |
| 1425 | 1430 | ||
| @@ -1480,19 +1485,21 @@ bool mod_color_calculate_degamma_params(struct dc_transfer_func *input_tf, | |||
| 1480 | 1485 | ||
| 1481 | input_tf->type = TF_TYPE_DISTRIBUTED_POINTS; | 1486 | input_tf->type = TF_TYPE_DISTRIBUTED_POINTS; |
| 1482 | 1487 | ||
| 1483 | rgb_user = kvzalloc(sizeof(*rgb_user) * (ramp->num_entries + _EXTRA_POINTS), | 1488 | rgb_user = kvcalloc(ramp->num_entries + _EXTRA_POINTS, |
| 1489 | sizeof(*rgb_user), | ||
| 1484 | GFP_KERNEL); | 1490 | GFP_KERNEL); |
| 1485 | if (!rgb_user) | 1491 | if (!rgb_user) |
| 1486 | goto rgb_user_alloc_fail; | 1492 | goto rgb_user_alloc_fail; |
| 1487 | curve = kvzalloc(sizeof(*curve) * (MAX_HW_POINTS + _EXTRA_POINTS), | 1493 | curve = kvcalloc(MAX_HW_POINTS + _EXTRA_POINTS, sizeof(*curve), |
| 1488 | GFP_KERNEL); | 1494 | GFP_KERNEL); |
| 1489 | if (!curve) | 1495 | if (!curve) |
| 1490 | goto curve_alloc_fail; | 1496 | goto curve_alloc_fail; |
| 1491 | axix_x = kvzalloc(sizeof(*axix_x) * (ramp->num_entries + _EXTRA_POINTS), | 1497 | axix_x = kvcalloc(ramp->num_entries + _EXTRA_POINTS, sizeof(*axix_x), |
| 1492 | GFP_KERNEL); | 1498 | GFP_KERNEL); |
| 1493 | if (!axix_x) | 1499 | if (!axix_x) |
| 1494 | goto axix_x_alloc_fail; | 1500 | goto axix_x_alloc_fail; |
| 1495 | coeff = kvzalloc(sizeof(*coeff) * (MAX_HW_POINTS + _EXTRA_POINTS), GFP_KERNEL); | 1501 | coeff = kvcalloc(MAX_HW_POINTS + _EXTRA_POINTS, sizeof(*coeff), |
| 1502 | GFP_KERNEL); | ||
| 1496 | if (!coeff) | 1503 | if (!coeff) |
| 1497 | goto coeff_alloc_fail; | 1504 | goto coeff_alloc_fail; |
| 1498 | 1505 | ||
| @@ -1569,8 +1576,8 @@ bool mod_color_calculate_curve(enum dc_transfer_func_predefined trans, | |||
| 1569 | } | 1576 | } |
| 1570 | ret = true; | 1577 | ret = true; |
| 1571 | } else if (trans == TRANSFER_FUNCTION_PQ) { | 1578 | } else if (trans == TRANSFER_FUNCTION_PQ) { |
| 1572 | rgb_regamma = kvzalloc(sizeof(*rgb_regamma) * | 1579 | rgb_regamma = kvcalloc(MAX_HW_POINTS + _EXTRA_POINTS, |
| 1573 | (MAX_HW_POINTS + _EXTRA_POINTS), | 1580 | sizeof(*rgb_regamma), |
| 1574 | GFP_KERNEL); | 1581 | GFP_KERNEL); |
| 1575 | if (!rgb_regamma) | 1582 | if (!rgb_regamma) |
| 1576 | goto rgb_regamma_alloc_fail; | 1583 | goto rgb_regamma_alloc_fail; |
| @@ -1594,8 +1601,8 @@ bool mod_color_calculate_curve(enum dc_transfer_func_predefined trans, | |||
| 1594 | kvfree(rgb_regamma); | 1601 | kvfree(rgb_regamma); |
| 1595 | } else if (trans == TRANSFER_FUNCTION_SRGB || | 1602 | } else if (trans == TRANSFER_FUNCTION_SRGB || |
| 1596 | trans == TRANSFER_FUNCTION_BT709) { | 1603 | trans == TRANSFER_FUNCTION_BT709) { |
| 1597 | rgb_regamma = kvzalloc(sizeof(*rgb_regamma) * | 1604 | rgb_regamma = kvcalloc(MAX_HW_POINTS + _EXTRA_POINTS, |
| 1598 | (MAX_HW_POINTS + _EXTRA_POINTS), | 1605 | sizeof(*rgb_regamma), |
| 1599 | GFP_KERNEL); | 1606 | GFP_KERNEL); |
| 1600 | if (!rgb_regamma) | 1607 | if (!rgb_regamma) |
| 1601 | goto rgb_regamma_alloc_fail; | 1608 | goto rgb_regamma_alloc_fail; |
| @@ -1638,8 +1645,8 @@ bool mod_color_calculate_degamma_curve(enum dc_transfer_func_predefined trans, | |||
| 1638 | } | 1645 | } |
| 1639 | ret = true; | 1646 | ret = true; |
| 1640 | } else if (trans == TRANSFER_FUNCTION_PQ) { | 1647 | } else if (trans == TRANSFER_FUNCTION_PQ) { |
| 1641 | rgb_degamma = kvzalloc(sizeof(*rgb_degamma) * | 1648 | rgb_degamma = kvcalloc(MAX_HW_POINTS + _EXTRA_POINTS, |
| 1642 | (MAX_HW_POINTS + _EXTRA_POINTS), | 1649 | sizeof(*rgb_degamma), |
| 1643 | GFP_KERNEL); | 1650 | GFP_KERNEL); |
| 1644 | if (!rgb_degamma) | 1651 | if (!rgb_degamma) |
| 1645 | goto rgb_degamma_alloc_fail; | 1652 | goto rgb_degamma_alloc_fail; |
| @@ -1658,8 +1665,8 @@ bool mod_color_calculate_degamma_curve(enum dc_transfer_func_predefined trans, | |||
| 1658 | kvfree(rgb_degamma); | 1665 | kvfree(rgb_degamma); |
| 1659 | } else if (trans == TRANSFER_FUNCTION_SRGB || | 1666 | } else if (trans == TRANSFER_FUNCTION_SRGB || |
| 1660 | trans == TRANSFER_FUNCTION_BT709) { | 1667 | trans == TRANSFER_FUNCTION_BT709) { |
| 1661 | rgb_degamma = kvzalloc(sizeof(*rgb_degamma) * | 1668 | rgb_degamma = kvcalloc(MAX_HW_POINTS + _EXTRA_POINTS, |
| 1662 | (MAX_HW_POINTS + _EXTRA_POINTS), | 1669 | sizeof(*rgb_degamma), |
| 1663 | GFP_KERNEL); | 1670 | GFP_KERNEL); |
| 1664 | if (!rgb_degamma) | 1671 | if (!rgb_degamma) |
| 1665 | goto rgb_degamma_alloc_fail; | 1672 | goto rgb_degamma_alloc_fail; |
diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c index 27d4003aa2c7..fa344ceafc17 100644 --- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c +++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c | |||
| @@ -155,7 +155,8 @@ struct mod_freesync *mod_freesync_create(struct dc *dc) | |||
| 155 | if (core_freesync == NULL) | 155 | if (core_freesync == NULL) |
| 156 | goto fail_alloc_context; | 156 | goto fail_alloc_context; |
| 157 | 157 | ||
| 158 | core_freesync->map = kzalloc(sizeof(struct freesync_entity) * MOD_FREESYNC_MAX_CONCURRENT_STREAMS, | 158 | core_freesync->map = kcalloc(MOD_FREESYNC_MAX_CONCURRENT_STREAMS, |
| 159 | sizeof(struct freesync_entity), | ||
| 159 | GFP_KERNEL); | 160 | GFP_KERNEL); |
| 160 | 161 | ||
| 161 | if (core_freesync->map == NULL) | 162 | if (core_freesync->map == NULL) |
diff --git a/drivers/gpu/drm/amd/display/modules/stats/stats.c b/drivers/gpu/drm/amd/display/modules/stats/stats.c index 3f7d47fdc367..710852ad03f3 100644 --- a/drivers/gpu/drm/amd/display/modules/stats/stats.c +++ b/drivers/gpu/drm/amd/display/modules/stats/stats.c | |||
| @@ -141,19 +141,17 @@ struct mod_stats *mod_stats_create(struct dc *dc) | |||
| 141 | else | 141 | else |
| 142 | core_stats->entries = reg_data; | 142 | core_stats->entries = reg_data; |
| 143 | } | 143 | } |
| 144 | core_stats->time = kzalloc( | 144 | core_stats->time = kcalloc(core_stats->entries, |
| 145 | sizeof(struct stats_time_cache) * | 145 | sizeof(struct stats_time_cache), |
| 146 | core_stats->entries, | ||
| 147 | GFP_KERNEL); | 146 | GFP_KERNEL); |
| 148 | 147 | ||
| 149 | if (core_stats->time == NULL) | 148 | if (core_stats->time == NULL) |
| 150 | goto fail_construct_time; | 149 | goto fail_construct_time; |
| 151 | 150 | ||
| 152 | core_stats->event_entries = DAL_STATS_EVENT_ENTRIES_DEFAULT; | 151 | core_stats->event_entries = DAL_STATS_EVENT_ENTRIES_DEFAULT; |
| 153 | core_stats->events = kzalloc( | 152 | core_stats->events = kcalloc(core_stats->event_entries, |
| 154 | sizeof(struct stats_event_cache) * | 153 | sizeof(struct stats_event_cache), |
| 155 | core_stats->event_entries, | 154 | GFP_KERNEL); |
| 156 | GFP_KERNEL); | ||
| 157 | 155 | ||
| 158 | if (core_stats->events == NULL) | 156 | if (core_stats->events == NULL) |
| 159 | goto fail_construct_events; | 157 | goto fail_construct_events; |
