Skip to contentSkip to conversation

media: vimc: Fix error return code in vimc_register_devices()

PATCH In review Wei Yongjun 2 participants 2 messages Oct 8, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: vimc: Fix error return code in vimc_register_devices()

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.

Fixes f13d5f361959 ("media: vimc: Collapse component structure into a single monolithic driver")
---
 drivers/media/platform/vimc/vimc-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/platform/vimc/vimc-core.c +3 -1
index 6e3e5c91ae39..2d20a7c10398 100644
@@ -202,8 +202,10 @@ static int vimc_register_devices(struct vimc_device *vimc)
 	vimc->ent_devs = kmalloc_array(vimc->pipe_cfg->num_ents,
 				       sizeof(*vimc->ent_devs),
 				       GFP_KERNEL);
-	if (!vimc->ent_devs)
+	if (!vimc->ent_devs) {
+		ret = -ENOMEM;
 		goto err_v4l2_unregister;
+	}
 
 	/* Invoke entity config hooks to initialize and register subdevs */
 	ret = vimc_add_subdevs(vimc);
Acked-by on v1 1/1
#1 lore raw

Hi,

Quoted 5 lines · Wei Yongjun

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.

Fixes f13d5f361959 ("media: vimc: Collapse component structure into a single monolithic driver")

Thank you
Helen

Quoted 23 lines
---
 drivers/media/platform/vimc/vimc-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/platform/vimc/vimc-core.c +3 -1
index 6e3e5c91ae39..2d20a7c10398 100644
@@ -202,8 +202,10 @@ static int vimc_register_devices(struct vimc_device *vimc)
 	vimc->ent_devs = kmalloc_array(vimc->pipe_cfg->num_ents,
 				       sizeof(*vimc->ent_devs),
 				       GFP_KERNEL);
-	if (!vimc->ent_devs)
+	if (!vimc->ent_devs) {
+		ret = -ENOMEM;
 		goto err_v4l2_unregister;
+	}
 
 	/* Invoke entity config hooks to initialize and register subdevs */
 	ret = vimc_add_subdevs(vimc);