From patchwork Tue Oct 18 15:16:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9386035 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 8819A60762 for ; Thu, 20 Oct 2016 07:09:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7596329AEC for ; Thu, 20 Oct 2016 07:09:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 69D7029AEF; Thu, 20 Oct 2016 07:09:49 +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=unavailable 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 B507629AEC for ; Thu, 20 Oct 2016 07:09:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C65A46EA79; Thu, 20 Oct 2016 07:09:41 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org X-Greylist: delayed 340 seconds by postgrey-1.35 at gabe; Tue, 18 Oct 2016 15:22:55 UTC Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9698E6E757 for ; Tue, 18 Oct 2016 15:22:55 +0000 (UTC) Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0MGyyA-1c97Jj30Da-00DsIH; Tue, 18 Oct 2016 17:16:57 +0200 From: Arnd Bergmann To: Daniel Vetter , Jani Nikula , David Airlie Date: Tue, 18 Oct 2016 17:16:23 +0200 Message-Id: <20161018151652.2690201-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 MIME-Version: 1.0 X-Provags-ID: V03:K0:Ce4zls/6v//Ze59xbaiMBrkxiq8TBQIPF/dTU13yv937oQYoHI8 YMeEhGkW1qMoIXq3iHJ+lSQ0IBB2xGi4erKb1tl2yy6TmiOFF1BqRWsG9CcF/kNnT3i1fAV 2Jlx9+wAXb2aoY3CfiMhQoa4KJpMuY4u+VktcE+2X2YmA8xwM6ZUCskeVIrB8XG1w+zeaFz wsZLjX3RvF+QM10kljk3w== X-UI-Out-Filterresults: notjunk:1; V01:K0:ATVs2YnDqS0=:tAmxC0W6dGhU4jPzkpTcsP CiUhalD51aRWm3473PXhwKZpKdZlUx/lqCYnBXW5qs0zvNnyyRkzc4njVGG7bojrHoVf25Opd 983wPH6Q5kFGEQQtrGG9GWjjRbzfIOhhH+jINQ7fDCc2fAKbvpzUXzmHd+jCLOnwBq3OPgeQB 8QwGX0gQkfos5HWlMpcn4iRnA1rnG9MXH67aj4Tlx3XHAuSzBGJam22Cll7hp+c4TSkzqZPEj NjGZ4P1v5Tz/iBxuDJ+FOnhQiB6HOL8t6qFs2Ycmw8+QHuhXL+UI0bh7nCAb8vO9AI/ISnzyP w9DA9Z0NbzrM1FDTUB3l0ftvT5ZJPyUBxDh/Ug0CJpYGNd7q9fYScUYdWxTMeNpmXcubkfAk1 4rffEIn2uVZr7jGStG8dQjAu6+vZzi1FNfzJMgQtalzTVgu5TfKIBRLm8goMftD0c/Kbr/cjt drsdLceZGOfWrAM0AGS28pfu5e1QkSE5YmO0znv08nQZXVQILCbxLhsYqubFm18N+AU0xUP4S J49J2hYPlVJ9A+Z2RvjsKkli87soGY/tNrSL16+gx950riu+OIun3HYR/LuIpuEq+q1ftP8Zk 1Uvf3z2n6UbPJlhV6ZYXe4Io/YtOLxcrX1YCEjxt+EZLGkYUjkVu4EYiixJVq4bcCwqIiEu93 yzYXFwqmA/QoMEBTBTqtbTb/sVjqEivIjZ/ZM35kuv41FARxFKN4J2d71KSQyXw23ydENPLNp SFC/r1YWx7PDHzU8 X-Mailman-Approved-At: Thu, 20 Oct 2016 07:09:40 +0000 Cc: Ander Conselvan de Oliveira , Arnd Bergmann , Daniel Vetter , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Subject: [Intel-gfx] [PATCH] i915: don't call drm_atomic_state_put on invalid pointer X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP The introduction of reference counting on the state structures caused sanitize_watermarks() in i915 to break in the error handling case, as pointed out by gcc -Wmaybe-uninitialized drivers/gpu/drm/i915/intel_display.c: In function ‘intel_modeset_init’: include/drm/drm_atomic.h:224:2: error: ‘state’ may be used uninitialized in this function [-Werror=maybe-uninitialized] This changes the function back to only drop the reference count when it was successfully allocated first. Fixes: 0853695c3ba4 ("drm: Add reference counting to drm_atomic_state") Cc: Chris Wilson Cc: Daniel Vetter Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/i915/intel_display.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 6d168685bbda..6a26da143aa6 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -16314,7 +16314,7 @@ static void sanitize_watermarks(struct drm_device *dev) * BIOS-programmed watermarks untouched and hope for the best. */ WARN(true, "Could not determine valid watermarks for inherited state\n"); - goto fail; + goto put_state; } /* Write calculated watermark values back */ @@ -16325,8 +16325,9 @@ static void sanitize_watermarks(struct drm_device *dev) dev_priv->display.optimize_watermarks(cs); } -fail: +put_state: drm_atomic_state_put(state); +fail: drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); }