Skip to contentSkip to conversation

drm/nouveau: fix locking issues in page flipping paths

DISCUSSION Dan Carpenter 1 participant 1 message Jul 24, 2013

lore
Share & tools
lore
#0 lore raw

Hello Ben Skeggs,

The patch 060810d7abaa: "drm/nouveau: fix locking issues in page flipping paths" from Jul 8, 2013, leads to the following Smatch warning:
"drivers/gpu/drm/nouveau/nouveau_display.c:599 nouveau_crtc_page_flip()

	 error: double unlock 'mutex:&chan->cli->mutex'"

drivers/gpu/drm/nouveau/nouveau_display.c
582 ret = nouveau_page_flip_emit(chan, old_bo, new_bo, s, &fence);

   583          mutex_unlock(&chan->cli->mutex);
                ^^^^^^^^^^^^

Unlock.

584 if (ret)
585 goto fail_unreserve;
586
587 /* Update the crtc struct and cleanup */
588 crtc->fb = fb;
589
590 ttm_eu_fence_buffer_objects(&ticket, &res, fence);
591 if (old_bo != new_bo)
592 nouveau_bo_unpin(old_bo);
593 nouveau_fence_unref(&fence);
594 return 0;
595
596 fail_unreserve:
597 ttm_eu_backoff_reservation(&ticket, &res);
598 fail_unpin:

   599          mutex_unlock(&chan->cli->mutex);
                ^^^^^^^^^^^^

Second unlock.

   600          if (old_bo != new_bo)
   601                  nouveau_bo_unpin(new_bo);

This looks simple enough to fix, but the previous two attempts at fixing the locking here have scared me a little. ;)

regards,
dan carpenter