diff options
author | AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> | 2022-01-18 14:37:59 +0100 |
---|---|---|
committer | Chun-Kuang Hu <chunkuang.hu@kernel.org> | 2022-04-06 00:27:23 +0200 |
commit | 07fb1e5babd5d3d4228517295db2ea4067ce2a79 (patch) | |
tree | ec7ef7df6c5e35e15316db41fea77c52a772b1f4 /drivers/gpu/drm/mediatek | |
parent | drm/mediatek: mtk_drm_plane: Use kmalloc in mtk_plane_duplicate_state (diff) | |
download | linux-07fb1e5babd5d3d4228517295db2ea4067ce2a79.tar.xz linux-07fb1e5babd5d3d4228517295db2ea4067ce2a79.zip |
drm/mediatek: mtk_drm_crtc: Use kmalloc in mtk_drm_crtc_duplicate_state
Optimize mtk_drm_crtc_duplicate_state() by switching from kzalloc() to
kmalloc(): the only variable of this struct that gets checked in other
functions is `pending_config`, but if that's set to false, then all of
the remaining variables will only ever be set, but not read - so, also
set `pending_config` to false.
This saves us some small overhead.
Link: https://patchwork.kernel.org/project/linux-mediatek/patch/20220118133759.112458-2-angelogioacchino.delregno@collabora.com/
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Diffstat (limited to 'drivers/gpu/drm/mediatek')
-rw-r--r-- | drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c index ede435d2c1ef..a6adc4ea48e1 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c @@ -184,7 +184,7 @@ static struct drm_crtc_state *mtk_drm_crtc_duplicate_state(struct drm_crtc *crtc { struct mtk_crtc_state *state; - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kmalloc(sizeof(*state), GFP_KERNEL); if (!state) return NULL; @@ -192,6 +192,7 @@ static struct drm_crtc_state *mtk_drm_crtc_duplicate_state(struct drm_crtc *crtc WARN_ON(state->base.crtc != crtc); state->base.crtc = crtc; + state->pending_config = false; return &state->base; } |