Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: stm32: dcmipp: correct error handling in dcmipp_create_subdevs

Correct error handling within the dcmipp_create_subdevs by properly
decrementing the i counter when releasing the subdevs.

Fixes: 28e0f3772296 ("media: stm32-dcmipp: STM32 DCMIPP camera interface driver")
Cc: stable@vger.kernel.org
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
[hverkuil: correct the indices: it's [i], not [i - 1].]

authored by

Alain Volmat and committed by
Hans Verkuil
a7351f0d 5d5f67b3

+2 -2
+2 -2
drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c
··· 202 202 return 0; 203 203 204 204 err_init_entity: 205 - while (i > 0) 206 - dcmipp->pipe_cfg->ents[i - 1].release(dcmipp->entity[i - 1]); 205 + while (i-- > 0) 206 + dcmipp->pipe_cfg->ents[i].release(dcmipp->entity[i]); 207 207 return ret; 208 208 } 209 209