media: atomisp: gc0310: Fix double free in gc0310_remove()

gc0310_remove() must not call kfree(dev) since the gc0310_device struct
is devm managed so explicitly freeing it causes a double free.

While at it add a missing mutex_destroy() call for the input_lock.

Link: https://lore.kernel.org/r/20230518153214.194976-6-hdegoede@redhat.com

Fixes: 340b4dd6c1 ("media: atomisp: gc0310: Use devm_kzalloc() for data struct")
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
Hans de Goede
2023-05-18 15:15:07 +01:00
committed by Mauro Carvalho Chehab
parent 76d2d7d6af
commit 2746a966f9

View File

@@ -377,8 +377,8 @@ static void gc0310_remove(struct i2c_client *client)
v4l2_device_unregister_subdev(sd);
media_entity_cleanup(&dev->sd.entity);
v4l2_ctrl_handler_free(&dev->ctrls.handler);
mutex_destroy(&dev->input_lock);
pm_runtime_disable(&client->dev);
kfree(dev);
}
static int gc0310_probe(struct i2c_client *client)