[bug report] drm/sun4i: backend: Check for the number of alpha planes
Dan Carpenter
dan.carpenter at oracle.com
Thu May 31 13:10:22 UTC 2018
Hello Maxime Ripard,
The patch 65f7fa3a3fcb: "drm/sun4i: backend: Check for the number of
alpha planes" from Jun 26, 2017, leads to the following static
checker warning:
drivers/gpu/drm/sun4i/sun4i_backend.c:486 sun4i_backend_atomic_check()
error: 'plane_state' dereferencing possible ERR_PTR()
drivers/gpu/drm/sun4i/sun4i_backend.c
462 static int sun4i_backend_atomic_check(struct sunxi_engine *engine,
463 struct drm_crtc_state *crtc_state)
464 {
465 struct drm_plane_state *plane_states[SUN4I_BACKEND_NUM_LAYERS] = { 0 };
466 struct drm_atomic_state *state = crtc_state->state;
467 struct drm_device *drm = state->dev;
468 struct drm_plane *plane;
469 unsigned int num_planes = 0;
470 unsigned int num_alpha_planes = 0;
471 unsigned int num_frontend_planes = 0;
472 unsigned int num_yuv_planes = 0;
473 unsigned int current_pipe = 0;
474 unsigned int i;
475
476 DRM_DEBUG_DRIVER("Starting checking our planes\n");
477
478 if (!crtc_state->planes_changed)
479 return 0;
480
481 drm_for_each_plane_mask(plane, drm, crtc_state->plane_mask) {
482 struct drm_plane_state *plane_state =
483 drm_atomic_get_plane_state(state, plane);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Not checked for failure.
484 struct sun4i_layer_state *layer_state =
485 state_to_sun4i_layer_state(plane_state);
486 struct drm_framebuffer *fb = plane_state->fb;
487 struct drm_format_name_buf format_name;
488
489 if (sun4i_backend_plane_uses_frontend(plane_state)) {
490 DRM_DEBUG_DRIVER("Using the frontend for plane %d\n",
491 plane->index);
492
493 layer_state->uses_frontend = true;
494 num_frontend_planes++;
495 } else {
496 layer_state->uses_frontend = false;
497 }
regards,
dan carpenter
More information about the dri-devel
mailing list