Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753834AbcLKRwS (ORCPT ); Sun, 11 Dec 2016 12:52:18 -0500 Received: from mail-wj0-f193.google.com ([209.85.210.193]:35396 "EHLO mail-wj0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753578AbcLKRwG (ORCPT ); Sun, 11 Dec 2016 12:52:06 -0500 From: Chris Wilson To: linux-kernel@vger.kernel.org Cc: intel-gfx@lists.freedesktop.org, Chris Wilson , Peter Zijlstra Subject: [PATCH 2/2] kref: Annotate kref_put_mutex() with might_lock() Date: Sun, 11 Dec 2016 17:52:01 +0000 Message-Id: <20161211175201.12411-2-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20161211175201.12411-1-chris@chris-wilson.co.uk> References: <20161211175201.12411-1-chris@chris-wilson.co.uk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 753 Lines: 24 As kref_put_mutex() may take the mutex (on the final unreference), mark it up with might_lock() so that the caller is unconditionally checked by lockdep. Signed-off-by: Chris Wilson Cc: Peter Zijlstra --- include/linux/kref.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/kref.h b/include/linux/kref.h index e15828fd71f1..f55b73674bfb 100644 --- a/include/linux/kref.h +++ b/include/linux/kref.h @@ -102,6 +102,7 @@ static inline int kref_put_mutex(struct kref *kref, void (*release)(struct kref *kref), struct mutex *lock) { + might_lock(lock); WARN_ON(release == NULL); if (unlikely(!atomic_add_unless(&kref->refcount, -1, 1))) { mutex_lock(lock); -- 2.11.0