]> git.baikalelectronics.ru Git - kernel.git/commitdiff
media: i2c: ad5820: Fix error path
authorRicardo Ribalda <ribalda@chromium.org>
Wed, 21 Sep 2022 11:38:00 +0000 (13:38 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:40:59 +0000 (11:40 +0100)
[ Upstream commit 9fce241660f37d9e95e93c0ae6fba8cfefa5797b ]

Error path seems to be swaped. Fix the order and provide some meaningful
names.

Fixes: 97428b1ef013 ("[media] ad5820: Add driver for auto-focus coil")
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/i2c/ad5820.c

index 7a49651f4d1f298dce3c0b1873768026004ea641..d7d85edeedd5ef927de7a7551dba2f79fcd718a3 100644 (file)
@@ -314,18 +314,18 @@ static int ad5820_probe(struct i2c_client *client,
 
        ret = media_entity_pads_init(&coil->subdev.entity, 0, NULL);
        if (ret < 0)
-               goto cleanup2;
+               goto clean_mutex;
 
        ret = v4l2_async_register_subdev(&coil->subdev);
        if (ret < 0)
-               goto cleanup;
+               goto clean_entity;
 
        return ret;
 
-cleanup2:
-       mutex_destroy(&coil->power_lock);
-cleanup:
+clean_entity:
        media_entity_cleanup(&coil->subdev.entity);
+clean_mutex:
+       mutex_destroy(&coil->power_lock);
        return ret;
 }