drm/i2c: tda998x: free the CEC device on encoder_destroy

Dan Carpenter dan.carpenter at oracle.com
Fri Jun 20 12:19:37 PDT 2014


Hello Jean-Francois Moine,

This is a semi-automatic email about new static checker warnings.

The patch fc275a74eb81: "drm/i2c: tda998x: free the CEC device on 
encoder_destroy" from Jan 25, 2014, leads to the following Smatch 
complaint:

drivers/gpu/drm/i2c/tda998x_drv.c:1194 tda998x_encoder_destroy()
	 warn: variable dereferenced before check 'priv->cec' (see line 1189)

drivers/gpu/drm/i2c/tda998x_drv.c
  1188		/* disable all IRQs and free the IRQ handler */
  1189		cec_write(priv, REG_CEC_RXSHPDINTENA, 0);
                          ^^^^
We need priv->cec for this.

  1190		reg_clear(priv, REG_INT_FLAGS_2, INT_FLAGS_2_EDID_BLK_RD);
  1191		if (priv->hdmi->irq)
  1192			free_irq(priv->hdmi->irq, priv);
  1193	
  1194		if (priv->cec)
                    ^^^^^^^^^
So hopefully this new check can be removed?

  1195			i2c_unregister_device(priv->cec);
  1196		kfree(priv);

regards,
dan carpenter


More information about the dri-devel mailing list