From patchwork Wed Apr 4 11:19:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 10322441 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D732860390 for ; Wed, 4 Apr 2018 11:19:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C04F728C4E for ; Wed, 4 Apr 2018 11:19:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3E5F28E55; Wed, 4 Apr 2018 11:19:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3E4D828C4E for ; Wed, 4 Apr 2018 11:19:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 825286E157; Wed, 4 Apr 2018 11:19:14 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8EBC66E157 for ; Wed, 4 Apr 2018 11:19:13 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Apr 2018 04:19:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,405,1517904000"; d="scan'208";a="30025477" Received: from saarniko-mobl1.ger.corp.intel.com (HELO localhost.localdomain) ([10.252.5.45]) by fmsmga008.fm.intel.com with ESMTP; 04 Apr 2018 04:19:11 -0700 From: Matthew Auld To: intel-gfx@lists.freedesktop.org Date: Wed, 4 Apr 2018 12:19:04 +0100 Message-Id: <20180404111904.2768-1-matthew.auld@intel.com> X-Mailer: git-send-email 2.14.3 Subject: [Intel-gfx] [PATCH] drm/i915: throw __must_check at GEM_WARN_ON X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP GEM_WARN_ON is intended to be used as: if (GEM_WARN_ON(expr)) ... However this isn't clear since we just wrap WARN_ON, therefore throw a warning if the result is ignored. For !DRM_I915_DEBUG_GEM builds this should already be the case. Suggested-by: Jani Nikula Signed-off-by: Matthew Auld Cc: Joonas Lahtinen Cc: Jani Nikula Cc: Chris Wilson Reviewed-by: Joonas Lahtinen --- drivers/gpu/drm/i915/i915_gem.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_gem.h b/drivers/gpu/drm/i915/i915_gem.h index 8922344fc21b..760671119130 100644 --- a/drivers/gpu/drm/i915/i915_gem.h +++ b/drivers/gpu/drm/i915/i915_gem.h @@ -36,7 +36,14 @@ BUG(); \ } \ } while(0) -#define GEM_WARN_ON(expr) WARN_ON(expr) + +static __always_inline bool __must_check __gem_warn_on(bool v) +{ + return WARN_ON(v); +} + +/* To be used as: if (GEM_WARN_ON(expr)) */ +#define GEM_WARN_ON(expr) __gem_warn_on(expr) #define GEM_DEBUG_DECL(var) var #define GEM_DEBUG_EXEC(expr) expr