If state allocation fails, we still try to give back the reference on it. Also initialize ret in case the crtc is not enabled and we hit the eject button.
Unified · Split
| @@ -69,14 +69,14 @@ static void drm_self_refresh_helper_entry_work(struct work_struct *work) · 68 unmodified lines | ||
| 69 | 69 | struct drm_connector *conn; |
| 70 | 70 | struct drm_connector_state *conn_state; |
| 71 | 71 | struct drm_crtc_state *crtc_state; |
| 72 | − int i, ret; | |
| 72 | + int i, ret = 0; | |
| 73 | 73 | |
| 74 | 74 | drm_modeset_acquire_init(&ctx, 0); |
| 75 | 75 | |
| 76 | 76 | state = drm_atomic_state_alloc(dev); |
| 77 | 77 | if (!state) { |
| 78 | 78 | ret = -ENOMEM; |
| 79 | − goto out; | |
| 79 | + goto out_drop_locks; | |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | retry: |
| @@ -116,6 +116,8 @@ out: · 33 unmodified lines | ||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | drm_atomic_state_put(state); |
| 119 | + | |
| 120 | +out_drop_locks: | |
| 119 | 121 | drm_modeset_drop_locks(&ctx); |
| 120 | 122 | drm_modeset_acquire_fini(&ctx); |
| 121 | 123 | } |