Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 36672dd

Browse files
Sui Jingfengsuijingfeng
authored andcommitted
drm/loongson: Remove a useless check in cursor_plane_atomic_async_check()
Because smatch warnings: drivers/gpu/drm/loongson/lsdc_plane.c:199 lsdc_cursor_plane_atomic_async_check() warn: variable dereferenced before check 'state' (see line 180) vim +/state +199 drivers/gpu/drm/loongson/lsdc_plane.c 174 static int lsdc_cursor_plane_atomic_async_check(struct drm_plane *plane, 175 struct drm_atomic_state *state) 176 { 177 struct drm_plane_state *new_state; 178 struct drm_crtc_state *crtc_state; 179 180 new_state = drm_atomic_get_new_plane_state(state, plane); ^^^^^ state is dereferenced inside this function 181 182 if (!plane->state || !plane->state->fb) { 183 drm_dbg(plane->dev, "%s: state is NULL\n", plane->name); 184 return -EINVAL; 185 } 186 187 if (new_state->crtc_w != new_state->crtc_h) { 188 drm_dbg(plane->dev, "unsupported cursor size: %ux%u\n", 189 new_state->crtc_w, new_state->crtc_h); 190 return -EINVAL; 191 } 192 193 if (new_state->crtc_w != 64 && new_state->crtc_w != 32) { 194 drm_dbg(plane->dev, "unsupported cursor size: %ux%u\n", 195 new_state->crtc_w, new_state->crtc_h); 196 return -EINVAL; 197 } 198 199 if (state) { ^^^^^ Checked too late! Reported-by: Dan Carpenter <[email protected]> Closes: https://lore.kernel.org/r/[email protected]/ Signed-off-by: Sui Jingfeng <[email protected]> Acked-by: Thomas Zimmermann <[email protected]> Signed-off-by: Sui Jingfeng <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent ca6c1e2 commit 36672dd

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

drivers/gpu/drm/loongson/lsdc_plane.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,7 @@ static int lsdc_cursor_plane_atomic_async_check(struct drm_plane *plane,
196196
return -EINVAL;
197197
}
198198

199-
if (state) {
200-
crtc_state = drm_atomic_get_existing_crtc_state(state, new_state->crtc);
201-
} else {
202-
crtc_state = plane->crtc->state;
203-
drm_dbg(plane->dev, "%s: atomic state is NULL\n", plane->name);
204-
}
205-
199+
crtc_state = drm_atomic_get_existing_crtc_state(state, new_state->crtc);
206200
if (!crtc_state->active)
207201
return -EINVAL;
208202

0 commit comments

Comments
 (0)