From 48c7f30eeabd84bc938da8e60a1af33bb2072c4c Mon Sep 17 00:00:00 2001 From: jsg Date: Thu, 24 Feb 2022 12:52:42 +0000 Subject: [PATCH] drm/atomic: Don't pollute crtc_state->mode_blob with error pointers From Ville Syrjala a1596e0277ed430dc2f44b61ebc2c1ecdab718e4 in linux 5.15.y/5.15.25 439cf34c8e0a8a33d8c15a31be1b7423426bc765 in mainline linux --- sys/dev/pci/drm/drm_atomic_uapi.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/dev/pci/drm/drm_atomic_uapi.c b/sys/dev/pci/drm/drm_atomic_uapi.c index 59bda72bfd1..4ff69a96795 100644 --- a/sys/dev/pci/drm/drm_atomic_uapi.c +++ b/sys/dev/pci/drm/drm_atomic_uapi.c @@ -77,15 +77,17 @@ int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state, state->mode_blob = NULL; if (mode) { + struct drm_property_blob *blob; + drm_mode_convert_to_umode(&umode, mode); - state->mode_blob = - drm_property_create_blob(state->crtc->dev, - sizeof(umode), - &umode); - if (IS_ERR(state->mode_blob)) - return PTR_ERR(state->mode_blob); + blob = drm_property_create_blob(crtc->dev, + sizeof(umode), &umode); + if (IS_ERR(blob)) + return PTR_ERR(blob); drm_mode_copy(&state->mode, mode); + + state->mode_blob = blob; state->enable = true; drm_dbg_atomic(crtc->dev, "Set [MODE:%s] for [CRTC:%d:%s] state %p\n", -- 2.20.1