The error path of hibmc_load() calls hibmc_unload(), which only calls
drm_atomic_helper_shutdown().
However, all the failures handled there (hibmc_kms_init(),
drm_vblank_init() and hibmc_msi_init()) happen before
drm_mode_config_reset() has run, so the CRTC state is still NULL at
that point. drm_atomic_helper_shutdown() will then go through
drm_atomic_helper_disable_all() and drm_atomic_get_crtc_state() to
drm_atomic_helper_crtc_duplicate_state(), which trips its
WARN_ON(!crtc->state) and returns an error.
Since the device hasn't been registered and no atomic commit ever ran
when hibmc_load() fails, there's nothing to shut down in the first
place. Remove that call.
hibmc_unload() is still called by hibmc_pci_probe() and
hibmc_pci_remove(), where the initial state has been created.
It will also be needed when drm_mode_config_reset() gets replaced by
drm_mode_config_create_initial_state(), whose state allocation can
fail.
Fixes: b11bc1ae46587 ("drm/hisilicon/hibmc: Add MSI irq getting and requesting
for HPD")
Reported-by: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Maxime Ripard <[email protected]>
---
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
index 602930964e93..272a8ab6427a 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
@@ -417,11 +417,10 @@ static int hibmc_load(struct drm_device *dev)
drmm_kms_helper_poll_init(dev);
return 0;
err:
- hibmc_unload(dev);
drm_err(dev, "failed to initialize drm driver: %d\n", ret);
return ret;
}
static int hibmc_pci_probe(struct pci_dev *pdev,
--
2.56.1