diff options
author | Hans de Goede <hdegoede@redhat.com> | 2024-10-13 17:40:55 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2024-11-07 15:16:06 +0100 |
commit | f6d364dbad0407ca1bb5b476bc50b830dae0a603 (patch) | |
tree | b6e8115820f91dd0102040377388c2de111ce835 | |
parent | media: atomisp: mt9m114: Disable V4L2_CID_3A_LOCK control (diff) | |
download | linux-f6d364dbad0407ca1bb5b476bc50b830dae0a603.tar.xz linux-f6d364dbad0407ca1bb5b476bc50b830dae0a603.zip |
media: atomisp: mt9m114: Add missing mutex_init() call
The input_lock was not being initialized, fix this.
Also switch to devm_kzalloc() for the main driver data struct, so that
devm_mutex_init() can be used for this.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20241013154056.12532-4-hdegoede@redhat.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
-rw-r--r-- | drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c index b0b740dd3ca3..1a67f93a53d7 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c @@ -30,6 +30,7 @@ #include <linux/delay.h> #include <linux/i2c.h> #include <linux/acpi.h> +#include <linux/mutex.h> #include "../include/linux/atomisp_gmin_platform.h" #include <media/v4l2-device.h> @@ -1527,7 +1528,6 @@ static void mt9m114_remove(struct i2c_client *client) v4l2_device_unregister_subdev(sd); media_entity_cleanup(&dev->sd.entity); v4l2_ctrl_handler_free(&dev->ctrl_handler); - kfree(dev); } static int mt9m114_probe(struct i2c_client *client) @@ -1538,10 +1538,14 @@ static int mt9m114_probe(struct i2c_client *client) void *pdata; /* Setup sensor configuration structure */ - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc(&client->dev, sizeof(*dev), GFP_KERNEL); if (!dev) return -ENOMEM; + ret = devm_mutex_init(&client->dev, &dev->input_lock); + if (ret) + return ret; + v4l2_i2c_subdev_init(&dev->sd, client, &mt9m114_ops); pdata = gmin_camera_platform_data(&dev->sd, ATOMISP_INPUT_FORMAT_RAW_10, @@ -1550,14 +1554,12 @@ static int mt9m114_probe(struct i2c_client *client) ret = mt9m114_s_config(&dev->sd, client->irq, pdata); if (!pdata || ret) { v4l2_device_unregister_subdev(&dev->sd); - kfree(dev); return ret; } ret = atomisp_register_i2c_module(&dev->sd, pdata); if (ret) { v4l2_device_unregister_subdev(&dev->sd); - kfree(dev); /* Coverity CID 298095 - return on error */ return ret; } |