[bug report] drm/ingenic: Add support for the IPU
Dan Carpenter
dan.carpenter at oracle.com
Mon Jul 20 07:24:44 UTC 2020
On Mon, Jul 20, 2020 at 10:22:37AM +0300, dan.carpenter at oracle.com wrote:
> Hello Paul Cercueil,
>
> The patch fc1acf317b01: "drm/ingenic: Add support for the IPU" from
> Jul 16, 2020, leads to the following static checker warning:
>
> drivers/gpu/drm/ingenic/ingenic-drm-drv.c:232 ingenic_drm_crtc_atomic_check()
> error: potentially dereferencing uninitialized 'ipu_state'.
>
> drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> 197 static int ingenic_drm_crtc_atomic_check(struct drm_crtc *crtc,
> 198 struct drm_crtc_state *state)
> 199 {
> 200 struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
> 201 struct drm_plane_state *f1_state, *f0_state, *ipu_state;
> 202 long rate;
> 203
> 204 if (!drm_atomic_crtc_needs_modeset(state))
> 205 return 0;
> 206
> 207 if (state->mode.hdisplay > priv->soc_info->max_width ||
> 208 state->mode.vdisplay > priv->soc_info->max_height)
> 209 return -EINVAL;
> 210
> 211 rate = clk_round_rate(priv->pix_clk,
> 212 state->adjusted_mode.clock * 1000);
> 213 if (rate < 0)
> 214 return rate;
> 215
> 216 if (priv->soc_info->has_osd) {
> 217 f1_state = drm_atomic_get_plane_state(state->state, &priv->f1);
> 218 f0_state = drm_atomic_get_plane_state(state->state, &priv->f0);
drivers/gpu/drm/ingenic/ingenic-drm-drv.c:224 ingenic_drm_crtc_atomic_check() error: 'f1_state' dereferencing possible ERR_PTR()
drivers/gpu/drm/ingenic/ingenic-drm-drv.c:224 ingenic_drm_crtc_atomic_check() error: 'ipu_state' dereferencing possible ERR_PTR()
drivers/gpu/drm/ingenic/ingenic-drm-drv.c:231 ingenic_drm_crtc_atomic_check() error: 'f1_state' dereferencing possible ERR_PTR()
drivers/gpu/drm/ingenic/ingenic-drm-drv.c:231 ingenic_drm_crtc_atomic_check() error: 'f0_state' dereferencing possible ERR_PTR()
drivers/gpu/drm/ingenic/ingenic-drm-drv.c:232 ingenic_drm_crtc_atomic_check() error: 'ipu_state' dereferencing possible ERR_PTR()
Also Smatch complains that these need error checking.
regards,
dan carpenter
More information about the dri-devel
mailing list