WSL2-Linux-Kernel/drivers/gpu/drm/vc4
Yuan Can bc79cb9fb0 drm/vc4: Fix missing platform_unregister_drivers() call in vc4_drm_register()
[ Upstream commit cf53db768a ]

A problem about modprobe vc4 failed is triggered with the following log
given:

 [  420.327987] Error: Driver 'vc4_hvs' is already registered, aborting...
 [  420.333904] failed to register platform driver vc4_hvs_driver [vc4]: -16
 modprobe: ERROR: could not insert 'vc4': Device or resource busy

The reason is that vc4_drm_register() returns platform_driver_register()
directly without checking its return value, if platform_driver_register()
fails, it returns without unregistering all the vc4 drivers, resulting the
vc4 can never be installed later.
A simple call graph is shown as below:

 vc4_drm_register()
   platform_register_drivers() # all vc4 drivers are registered
   platform_driver_register()
     driver_register()
       bus_add_driver()
         priv = kzalloc(...) # OOM happened
   # return without unregister drivers

Fixing this problem by checking the return value of
platform_driver_register() and do platform_unregister_drivers() if
error happened.

Fixes: c8b75bca92 ("drm/vc4: Add KMS support for Raspberry Pi.")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20221103014705.109322-1-yuancan@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-11-16 09:58:18 +01:00
..
Kconfig drm/vc4: hdmi: Depends on CONFIG_PM 2022-09-05 10:30:03 +02:00
Makefile drm/vc4: hdmi: Add PHY init and disable function 2020-09-07 18:06:04 +02:00
vc4_bo.c drm/vc4: fix error code in vc4_create_object() 2021-12-01 09:04:47 +01:00
vc4_crtc.c drm/vc4: hdmi: Fix timings for interlaced modes 2022-08-17 14:23:26 +02:00
vc4_debugfs.c drm/vc4/vc4_debugfs: Demote non-conformant kernel-doc headers 2020-11-18 11:51:58 +01:00
vc4_dpi.c
vc4_drv.c drm/vc4: Fix missing platform_unregister_drivers() call in vc4_drm_register() 2022-11-16 09:58:18 +01:00
vc4_drv.h drm/vc4: hvs: Fix frame count register readout 2022-06-09 10:22:45 +02:00
vc4_dsi.c drm/vc4: dsi: Add correct stop condition to vc4_dsi_encoder_disable iteration 2022-08-17 14:23:25 +02:00
vc4_fence.c
vc4_gem.c drm/vc4: remove unneeded variable: "ret" 2021-02-09 17:16:57 +01:00
vc4_hdmi.c drm/vc4: hdmi: Depends on CONFIG_PM 2022-09-05 10:30:03 +02:00
vc4_hdmi.h drm/vc4: hdmi: Unregister codec device on unbind 2022-03-16 14:23:40 +01:00
vc4_hdmi_phy.c drm/vc4: hdmi: Use the connector state pixel rate for the PHY 2020-12-16 10:11:48 +01:00
vc4_hdmi_regs.h drm/vc4: hdmi: Reset HDMI MISC_CONTROL register 2022-08-17 14:23:26 +02:00
vc4_hvs.c drm/vc4: hvs: Reset muxes at probe time 2022-06-09 10:22:45 +02:00
vc4_irq.c drm/vc4: Convert to Linux IRQ interfaces 2021-08-10 20:13:53 +02:00
vc4_kms.c drm/vc4: crtc: Drop feed_txp from state 2022-01-27 11:05:25 +01:00
vc4_packet.h
vc4_perfmon.c drm/vc4: replace idr_init() by idr_init_base() 2020-11-06 11:48:43 +01:00
vc4_plane.c drm/vc4: plane: Fix margin calculations for the right/bottom edges 2022-08-17 14:23:24 +02:00
vc4_qpu_defines.h
vc4_regs.h drm/vc4: hvs: Fix frame count register readout 2022-06-09 10:22:45 +02:00
vc4_render_cl.c
vc4_trace.h
vc4_trace_points.c
vc4_txp.c drm/vc4: txp: Force alpha to be 0xff if it's disabled 2022-06-09 10:22:45 +02:00
vc4_v3d.c drm/vc4: Convert to Linux IRQ interfaces 2021-08-10 20:13:53 +02:00
vc4_validate.c
vc4_validate_shaders.c
vc4_vec.c drm/vc4: vec: Fix timings for VEC modes 2022-10-26 12:35:40 +02:00