linux/drivers/media/platform/samsung/exynos4-is
Yuan Can 48ecee6159 media: platform: exynos4-is: Fix error handling in fimc_md_init()
A problem about modprobe s5p_fimc failed is triggered with the
following log given:

 [  272.075275] Error: Driver 'exynos4-fimc' is already registered, aborting...
 modprobe: ERROR: could not insert 's5p_fimc': Device or resource busy

The reason is that fimc_md_init() returns platform_driver_register()
directly without checking its return value, if platform_driver_register()
failed, it returns without unregister fimc_driver, resulting the
s5p_fimc can never be installed later.
A simple call graph is shown as below:

 fimc_md_init()
   fimc_register_driver() # register fimc_driver
   platform_driver_register()
     platform_driver_register()
       driver_register()
         bus_add_driver()
           dev = kzalloc(...) # OOM happened
   # return without unregister fimc_driver

Fix by unregister fimc_driver when platform_driver_register() returns
error.

Fixes: d3953223b0 ("[media] s5p-fimc: Add the media device driver")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-11-25 07:37:53 +00:00
..
common.c media: mc-entity: Rename media_entity_remote_pad() to media_pad_remote_pad_first() 2022-07-17 11:21:35 +01:00
common.h
fimc-capture.c media: drivers: use video device pipeline start/stop 2022-09-24 09:14:20 +02:00
fimc-core.c media: platform: exynos4-is: Fix error handling in fimc_md_init() 2022-11-25 07:37:53 +00:00
fimc-core.h media: avoid use of 'videobuf' 2022-08-29 16:27:18 +02:00
fimc-is-command.h
fimc-is-errno.c
fimc-is-errno.h media: platform: exynos4-is: fix typos in comments 2022-06-20 10:30:35 +01:00
fimc-is-i2c.c
fimc-is-i2c.h
fimc-is-param.c
fimc-is-param.h
fimc-is-regs.c
fimc-is-regs.h
fimc-is-sensor.c
fimc-is-sensor.h
fimc-is.c media: exynos4-is: fimc-is: Add of_node_put() when breaking out of loop 2022-08-30 07:27:21 +02:00
fimc-is.h
fimc-isp-video.c media: drivers: use video device pipeline start/stop 2022-09-24 09:14:20 +02:00
fimc-isp-video.h media: exynos4-is: Fix compile warning 2022-05-17 09:15:47 +02:00
fimc-isp.c
fimc-isp.h
fimc-lite-reg.c
fimc-lite-reg.h
fimc-lite.c media: drivers: use video device pipeline start/stop 2022-09-24 09:14:20 +02:00
fimc-lite.h
fimc-m2m.c
fimc-reg.c
fimc-reg.h
Kconfig
Makefile
media-dev.c media: platform: exynos4-is: Fix error handling in fimc_md_init() 2022-11-25 07:37:53 +00:00
media-dev.h
mipi-csis.c media: platform: exynos4-is: fix typos in comments 2022-06-20 10:30:35 +01:00
mipi-csis.h