drm/amd/display: Use 2-factor allocator calls
As already done treewide, switch from open-coded multiplication to 2-factor allocation helper. Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
25177e7f94
commit
4c1ac53eb8
@ -1723,8 +1723,8 @@ bool mod_color_calculate_curve(enum dc_transfer_func_predefined trans,
|
|||||||
kvfree(rgb_regamma);
|
kvfree(rgb_regamma);
|
||||||
} else if (trans == TRANSFER_FUNCTION_HLG ||
|
} else if (trans == TRANSFER_FUNCTION_HLG ||
|
||||||
trans == TRANSFER_FUNCTION_HLG12) {
|
trans == TRANSFER_FUNCTION_HLG12) {
|
||||||
rgb_regamma = kvzalloc(sizeof(*rgb_regamma) *
|
rgb_regamma = kvcalloc(MAX_HW_POINTS + _EXTRA_POINTS,
|
||||||
(MAX_HW_POINTS + _EXTRA_POINTS),
|
sizeof(*rgb_regamma),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!rgb_regamma)
|
if (!rgb_regamma)
|
||||||
goto rgb_regamma_alloc_fail;
|
goto rgb_regamma_alloc_fail;
|
||||||
@ -1802,8 +1802,8 @@ bool mod_color_calculate_degamma_curve(enum dc_transfer_func_predefined trans,
|
|||||||
kvfree(rgb_degamma);
|
kvfree(rgb_degamma);
|
||||||
} else if (trans == TRANSFER_FUNCTION_HLG ||
|
} else if (trans == TRANSFER_FUNCTION_HLG ||
|
||||||
trans == TRANSFER_FUNCTION_HLG12) {
|
trans == TRANSFER_FUNCTION_HLG12) {
|
||||||
rgb_degamma = kvzalloc(sizeof(*rgb_degamma) *
|
rgb_degamma = kvcalloc(MAX_HW_POINTS + _EXTRA_POINTS,
|
||||||
(MAX_HW_POINTS + _EXTRA_POINTS),
|
sizeof(*rgb_degamma),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!rgb_degamma)
|
if (!rgb_degamma)
|
||||||
goto rgb_degamma_alloc_fail;
|
goto rgb_degamma_alloc_fail;
|
||||||
|
Loading…
Reference in New Issue
Block a user