summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2023-02-05 12:12:24 +0000
committerMauro Carvalho Chehab <mchehab@kernel.org>2023-04-15 10:35:32 +0100
commit2b2297b11bb506e5b7152dd593d902bc309b7d54 (patch)
tree0ed406a79d469bd076ec59cf9609e661d3443bcf /drivers/staging
parentef5fb5d470d6b029db7c39196793937fcea83f1c (diff)
media: atomisp: gc0310: Add error_unlock label to s_stream()
Add error_unlock label + goto error_unlock on error to remove separate unlock-s in all the error-exit paths. 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>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/media/atomisp/i2c/atomisp-gc0310.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
index cf85fb926169..59da8d7ba25c 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
@@ -428,31 +428,27 @@ static int gc0310_s_stream(struct v4l2_subdev *sd, int enable)
if (enable) {
/* enable per frame MIPI and sensor ctrl reset */
ret = i2c_smbus_write_byte_data(client, 0xFE, 0x30);
- if (ret) {
- mutex_unlock(&dev->input_lock);
- return ret;
- }
+ if (ret)
+ goto error_unlock;
}
ret = i2c_smbus_write_byte_data(client, GC0310_RESET_RELATED, GC0310_REGISTER_PAGE_3);
- if (ret) {
- mutex_unlock(&dev->input_lock);
- return ret;
- }
+ if (ret)
+ goto error_unlock;
ret = i2c_smbus_write_byte_data(client, GC0310_SW_STREAM,
enable ? GC0310_START_STREAMING : GC0310_STOP_STREAMING);
- if (ret) {
- mutex_unlock(&dev->input_lock);
- return ret;
- }
+ if (ret)
+ goto error_unlock;
ret = i2c_smbus_write_byte_data(client, GC0310_RESET_RELATED, GC0310_REGISTER_PAGE_0);
- if (ret) {
- mutex_unlock(&dev->input_lock);
- return ret;
- }
+ if (ret)
+ goto error_unlock;
+
+ mutex_unlock(&dev->input_lock);
+ return 0;
+error_unlock:
mutex_unlock(&dev->input_lock);
return ret;
}