Hello Hans, > > Fix I2C-drivers which missed setting clientdata to NULL before freeing the > > structure it points to. Also fix drivers which do this _after_ the structure > > was freed already. > > I feel I am missing something here. Why does clientdata have to be set to > NULL when we are tearing down the device anyway? > > And if there is a good reason for doing this, then it should be done in > v4l2_device_unregister_subdev or even in the i2c core, not in each drivers. Discussion to take this into the i2c-layer has already started. Regarding V4L, I noticed there is a v4l2_i2c_subdev_init() but no v4l2_i2c_subdev_exit(), so I grepped what drivers are doing. There are some which set clientdata to NULL, so I thought this was accepted in general. > And why does coccinelle apparently find this in e.g. cs5345.c but not in > saa7115.c, which has exactly the same construct? For that matter, I think It was the to_state()-call inside kfree() which prevented the match. I would need to extend my patch for V4L, it seems. Regards, Wolfram -- Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Attachment:
signature.asc
Description: Digital signature