mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
drm/amd/display: Add NULL pointer checks in dm_force_atomic_commit()
This commit updates the dm_force_atomic_commit function to replace the usage of PTR_ERR_OR_ZERO with IS_ERR for checking error states after retrieving the Connector (drm_atomic_get_connector_state), CRTC (drm_atomic_get_crtc_state), and Plane (drm_atomic_get_plane_state) states. The function utilized PTR_ERR_OR_ZERO for error checking. However, this approach is inappropriate in this context because the respective functions do not return NULL; they return pointers that encode errors. This change ensures that error pointers are properly checked using IS_ERR before attempting to dereference. Cc: Harry Wentland <harry.wentland@amd.com> Cc: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Cc: Tom Chung <chiahsuan.chung@amd.com> Cc: Roman Li <roman.li@amd.com> Cc: Alex Hung <alex.hung@amd.com> Cc: Aurabindo Pillai <aurabindo.pillai@amd.com> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com> Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
42a6667780
commit
3f397cd203
@@ -10602,16 +10602,20 @@ static int dm_force_atomic_commit(struct drm_connector *connector)
|
||||
*/
|
||||
conn_state = drm_atomic_get_connector_state(state, connector);
|
||||
|
||||
ret = PTR_ERR_OR_ZERO(conn_state);
|
||||
if (ret)
|
||||
/* Check for error in getting connector state */
|
||||
if (IS_ERR(conn_state)) {
|
||||
ret = PTR_ERR(conn_state);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Attach crtc to drm_atomic_state*/
|
||||
crtc_state = drm_atomic_get_crtc_state(state, &disconnected_acrtc->base);
|
||||
|
||||
ret = PTR_ERR_OR_ZERO(crtc_state);
|
||||
if (ret)
|
||||
/* Check for error in getting crtc state */
|
||||
if (IS_ERR(crtc_state)) {
|
||||
ret = PTR_ERR(crtc_state);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* force a restore */
|
||||
crtc_state->mode_changed = true;
|
||||
@@ -10619,9 +10623,11 @@ static int dm_force_atomic_commit(struct drm_connector *connector)
|
||||
/* Attach plane to drm_atomic_state */
|
||||
plane_state = drm_atomic_get_plane_state(state, plane);
|
||||
|
||||
ret = PTR_ERR_OR_ZERO(plane_state);
|
||||
if (ret)
|
||||
/* Check for error in getting plane state */
|
||||
if (IS_ERR(plane_state)) {
|
||||
ret = PTR_ERR(plane_state);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Call commit internally with the state we just constructed */
|
||||
ret = drm_atomic_commit(state);
|
||||
|
||||
Reference in New Issue
Block a user