Skip to content

Commit

Permalink
[media] s5c73m3: Fix remove() callback to free requested resources
Browse files Browse the repository at this point in the history
Make sure v4l2_device_unregister_subdev() is called for both:
oif and sensor subdev and both media entities are freed on
driver removal.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Sylwester Nawrocki authored and Mauro Carvalho Chehab committed Apr 25, 2013
1 parent 068b16b commit 0c2224e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions drivers/media/i2c/s5c73m3/s5c73m3-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1668,13 +1668,17 @@ static int s5c73m3_probe(struct i2c_client *client,

static int s5c73m3_remove(struct i2c_client *client)
{
struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct s5c73m3 *state = sensor_sd_to_s5c73m3(sd);
struct v4l2_subdev *oif_sd = i2c_get_clientdata(client);
struct s5c73m3 *state = oif_sd_to_s5c73m3(oif_sd);
struct v4l2_subdev *sensor_sd = &state->sensor_sd;

v4l2_device_unregister_subdev(sd);
v4l2_device_unregister_subdev(oif_sd);

v4l2_ctrl_handler_free(sd->ctrl_handler);
media_entity_cleanup(&sd->entity);
v4l2_ctrl_handler_free(oif_sd->ctrl_handler);
media_entity_cleanup(&oif_sd->entity);

v4l2_device_unregister_subdev(sensor_sd);
media_entity_cleanup(&sensor_sd->entity);

s5c73m3_unregister_spi_driver(state);
s5c73m3_free_gpios(state);
Expand Down

0 comments on commit 0c2224e

Please sign in to comment.