mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-01 06:33:07 +00:00
drm/vc4: kms: Fix IS_ERR() vs NULL check for vc4_kms
[ Upstream commitdba9e34674
] The drm_atomic_get_new_private_obj_state() function returns NULL on error path, drm_atomic_get_old_private_obj_state() function returns NULL on error path, too, they does not return error pointers. By the way, vc4_hvs_get_new/old_global_state() should return ERR_PTR(-EINVAL), otherwise there will be null-ptr-defer issue, such as follows: In function vc4_atomic_commit_tail(): |-- old_hvs_state = vc4_hvs_get_old_global_state(state); <-- return NULL |-- if (WARN_ON(IS_ERR(old_hvs_state))) <-- no return |-- unsigned long state_rate = max(old_hvs_state->core_clock_rate, new_hvs_state->core_clock_rate); <-- null-ptr-defer Fixes:9ec03d7f1e
("drm/vc4: kms: Wait on previous FIFO users before a commit") Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Link: https://patchwork.freedesktop.org/patch/msgid/20221110094445.2930509-6-cuigaosheng1@huawei.com Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
5834a3a98c
commit
f0bf751585
1 changed files with 4 additions and 4 deletions
|
@ -198,8 +198,8 @@ vc4_hvs_get_new_global_state(struct drm_atomic_state *state)
|
||||||
struct drm_private_state *priv_state;
|
struct drm_private_state *priv_state;
|
||||||
|
|
||||||
priv_state = drm_atomic_get_new_private_obj_state(state, &vc4->hvs_channels);
|
priv_state = drm_atomic_get_new_private_obj_state(state, &vc4->hvs_channels);
|
||||||
if (IS_ERR(priv_state))
|
if (!priv_state)
|
||||||
return ERR_CAST(priv_state);
|
return ERR_PTR(-EINVAL);
|
||||||
|
|
||||||
return to_vc4_hvs_state(priv_state);
|
return to_vc4_hvs_state(priv_state);
|
||||||
}
|
}
|
||||||
|
@ -211,8 +211,8 @@ vc4_hvs_get_old_global_state(struct drm_atomic_state *state)
|
||||||
struct drm_private_state *priv_state;
|
struct drm_private_state *priv_state;
|
||||||
|
|
||||||
priv_state = drm_atomic_get_old_private_obj_state(state, &vc4->hvs_channels);
|
priv_state = drm_atomic_get_old_private_obj_state(state, &vc4->hvs_channels);
|
||||||
if (IS_ERR(priv_state))
|
if (!priv_state)
|
||||||
return ERR_CAST(priv_state);
|
return ERR_PTR(-EINVAL);
|
||||||
|
|
||||||
return to_vc4_hvs_state(priv_state);
|
return to_vc4_hvs_state(priv_state);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue