From patchwork Wed May 27 14:05:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11573087 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A015190 for ; Wed, 27 May 2020 14:11:01 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 880BF2073B for ; Wed, 27 May 2020 14:11:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 880BF2073B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arndb.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BC4F26E0B6; Wed, 27 May 2020 14:11:00 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org X-Greylist: delayed 314 seconds by postgrey-1.36 at gabe; Wed, 27 May 2020 14:10:59 UTC Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.133]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2D5466E0A8 for ; Wed, 27 May 2020 14:10:59 +0000 (UTC) Received: from threadripper.lan ([149.172.98.151]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1Myevl-1ioaSD1TtV-00z0dt; Wed, 27 May 2020 16:05:28 +0200 From: Arnd Bergmann To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , Tvrtko Ursulin , Chris Wilson Date: Wed, 27 May 2020 16:05:08 +0200 Message-Id: <20200527140526.1458215-1-arnd@arndb.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-Provags-ID: V03:K1:iA/oVTFZbT0EcafqZRx1usz2+oWll8ShFOXyKlbH3L+E47gvF24 rqK1c0Xjr6CQW/9Sy+2v5OER+rRGSk92oqcKN3TTYYe1sGIBdezAIm9CdYAHoiZtdDxhMQI s6KkiyxtAAfHu/e/ASnv9FV7L+EgSb4wsnxyLn0niqe6JnEiNM7wwJk2MjrmrOK2vTbuPmB ObhVD+c+lb9Xai3ZpB3eA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:HW0+l7O5ycs=:GlMbVvC7dDS8gvsRlbDAzq z3nIuWMnppQqwI3lnogMt8WTdNwZzVwTbmTNy8z/w6c9XEfWNY+HhNYfUt6lt2alxBgGw+gWO oQecD0qUlVG9szcXtHoDEBQ0PtPxKLLCtJp3aNi1Zx5nX8iBA1yQPMA/lNGOjuJI2MLgpRW/a yjh3Ima26i4KMhJXLEOTrVawKRa5mBevD3h0GKU4KC0d5vvxLa87AeW+vcSnvTGBQPgs3i8sX EiJCXQKHr7DQn6otas4/+RVNF0lkzOhr66vIpURs7bUBS2+1V6nXuXGbqkv7sShiMCcwIWfut EJKu8QRxSdPzXBidbCREGeY2oM0ioLsW9UaOcSKXTM9inNi7u4fQ7dotNXM7uE7PT5NWerdVr K0yLLpKZY61JCkLyMyZdF5SsT6xPO/Fek9yOO7MM3/PIPxiiqNJboXHrElSq/HMhAkWuhNbae IKtU3HjsYdZTqgw3QunOOkus3UJthLZkenAuqvJogThxi3j4fiwuWaJx0sLCKb4zmeEy9kROW e226omihlQlgCc3CYJSgM5sSwayNvFOolROXhOlrF/icQqXrqBl+TGOQywfXAf+O8DKRuP8sS Q5X3UprYZ0y+fs7Qekz1Bn+6w9cD5/9XPe12TfV//AdUAew/cboY6uKqOHfR+DX5Lh1Hvet4X D5DT/NV0ypNAriWA6ghhWOf8R6ke9k8bK/TwphEgKkgrMAPcn0wu6HaXvjWKf83MeNKfbGiOA LCOTdffOv2axhWSNrtD7uigfqSGFeF16TVnbKXLN7dAAbyw5rJ1kKqSqc6kaqVTUCJVYbSciI PZ21tITJpFvE3WomKMh9ZR2XEw8gP/EtN3LmHSOY3mNi9I+lXI= Subject: [Intel-gfx] [PATCH 1/3] drm/i915/pmu: avoid an maybe-uninitialized warning X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, =?utf-8?q?Mi?= =?utf-8?q?cha=C5=82_Winiarski?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Conditional spinlocks make it hard for gcc and for lockdep to follow the code flow. This one causes a warning with at least gcc-9 and higher: In file included from include/linux/irq.h:14, from drivers/gpu/drm/i915/i915_pmu.c:7: drivers/gpu/drm/i915/i915_pmu.c: In function 'i915_sample': include/linux/spinlock.h:289:3: error: 'flags' may be used uninitialized in this function [-Werror=maybe-uninitialized] 289 | _raw_spin_unlock_irqrestore(lock, flags); \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/i915_pmu.c:288:17: note: 'flags' was declared here 288 | unsigned long flags; | ^~~~~ Split out the part between the locks into a separate function for readability and to let the compiler figure out what the logic actually is. Fixes: d79e1bd676f0 ("drm/i915/pmu: Only use exclusive mmio access for gen7") Signed-off-by: Arnd Bergmann Reviewed-by: Chris Wilson --- I have no idea why I see three separate issues like this pop up in i915, there are not a lot of them elsewhere. drivers/gpu/drm/i915/i915_pmu.c | 84 ++++++++++++++++----------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c index e991a707bdb7..962ded9ce73f 100644 --- a/drivers/gpu/drm/i915/i915_pmu.c +++ b/drivers/gpu/drm/i915/i915_pmu.c @@ -269,12 +269,48 @@ static bool exclusive_mmio_access(const struct drm_i915_private *i915) return IS_GEN(i915, 7); } +static void engine_sample(struct intel_engine_cs *engine, unsigned int period_ns) +{ + struct intel_engine_pmu *pmu = &engine->pmu; + bool busy; + u32 val; + + val = ENGINE_READ_FW(engine, RING_CTL); + if (val == 0) /* powerwell off => engine idle */ + return; + + if (val & RING_WAIT) + add_sample(&pmu->sample[I915_SAMPLE_WAIT], period_ns); + if (val & RING_WAIT_SEMAPHORE) + add_sample(&pmu->sample[I915_SAMPLE_SEMA], period_ns); + + /* No need to sample when busy stats are supported. */ + if (intel_engine_supports_stats(engine)) + return; + + /* + * While waiting on a semaphore or event, MI_MODE reports the + * ring as idle. However, previously using the seqno, and with + * execlists sampling, we account for the ring waiting as the + * engine being busy. Therefore, we record the sample as being + * busy if either waiting or !idle. + */ + busy = val & (RING_WAIT_SEMAPHORE | RING_WAIT); + if (!busy) { + val = ENGINE_READ_FW(engine, RING_MI_MODE); + busy = !(val & MODE_IDLE); + } + if (busy) + add_sample(&pmu->sample[I915_SAMPLE_BUSY], period_ns); +} + static void engines_sample(struct intel_gt *gt, unsigned int period_ns) { struct drm_i915_private *i915 = gt->i915; struct intel_engine_cs *engine; enum intel_engine_id id; + unsigned long flags; if ((i915->pmu.enable & ENGINE_SAMPLE_MASK) == 0) return; @@ -283,53 +319,17 @@ engines_sample(struct intel_gt *gt, unsigned int period_ns) return; for_each_engine(engine, gt, id) { - struct intel_engine_pmu *pmu = &engine->pmu; - spinlock_t *mmio_lock; - unsigned long flags; - bool busy; - u32 val; - if (!intel_engine_pm_get_if_awake(engine)) continue; - mmio_lock = NULL; - if (exclusive_mmio_access(i915)) - mmio_lock = &engine->uncore->lock; - - if (unlikely(mmio_lock)) - spin_lock_irqsave(mmio_lock, flags); - - val = ENGINE_READ_FW(engine, RING_CTL); - if (val == 0) /* powerwell off => engine idle */ - goto skip; - - if (val & RING_WAIT) - add_sample(&pmu->sample[I915_SAMPLE_WAIT], period_ns); - if (val & RING_WAIT_SEMAPHORE) - add_sample(&pmu->sample[I915_SAMPLE_SEMA], period_ns); - - /* No need to sample when busy stats are supported. */ - if (intel_engine_supports_stats(engine)) - goto skip; - - /* - * While waiting on a semaphore or event, MI_MODE reports the - * ring as idle. However, previously using the seqno, and with - * execlists sampling, we account for the ring waiting as the - * engine being busy. Therefore, we record the sample as being - * busy if either waiting or !idle. - */ - busy = val & (RING_WAIT_SEMAPHORE | RING_WAIT); - if (!busy) { - val = ENGINE_READ_FW(engine, RING_MI_MODE); - busy = !(val & MODE_IDLE); + if (exclusive_mmio_access(i915)) { + spin_lock_irqsave(&engine->uncore->lock, flags); + engine_sample(engine, period_ns); + spin_unlock_irqrestore(&engine->uncore->lock, flags); + } else { + engine_sample(engine, period_ns); } - if (busy) - add_sample(&pmu->sample[I915_SAMPLE_BUSY], period_ns); -skip: - if (unlikely(mmio_lock)) - spin_unlock_irqrestore(mmio_lock, flags); intel_engine_pm_put_async(engine); } } From patchwork Wed May 27 14:05:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11573089 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED76A90 for ; Wed, 27 May 2020 14:11:04 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D649B2073B for ; Wed, 27 May 2020 14:11:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D649B2073B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arndb.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4073E6E0A8; Wed, 27 May 2020 14:11:04 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.187]) by gabe.freedesktop.org (Postfix) with ESMTPS id 555946E0A8 for ; Wed, 27 May 2020 14:11:00 +0000 (UTC) Received: from threadripper.lan ([149.172.98.151]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MLiXQ-1jMHJG1tIG-00HfcC; Wed, 27 May 2020 16:05:34 +0200 From: Arnd Bergmann To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , Tvrtko Ursulin , John Harrison Date: Wed, 27 May 2020 16:05:09 +0200 Message-Id: <20200527140526.1458215-2-arnd@arndb.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527140526.1458215-1-arnd@arndb.de> References: <20200527140526.1458215-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:XhGV89xHEat1ahk9vDcOini1cTFmNy3hR/+IomNkF0dDIF4zpZG mVIweZpVkM1y3GUbDfSqkcJna53e8KALJOgJZmp7Twzav4yEeJLd9a6aGl9MuGJqv39Lm+1 UtuYJ1CEH/1ruBsaqZOgZiXbw7k0vnL6MV+C46oN8FSuiZglkpaYnFEdXhsjxXy83Lxm7fj j/oHTDzvKdfuKAtc5lVow== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:u+QLjeALaVQ=:jmG4Z52iAPC4eAXZNdAQxH /KWYJ+K1SKnBO2jV5Gt0E0BWMq2e285pUR4EVQWWYNn6XA1m3e/pPOGxJNlIrQAxiwkQuQwlH edxGYT3+DSKPkUkrMxKzk3CUjiFhXQbLU+zDdetqfCPQORnx64+JaKzfsGdZKAt/jUlyhHawZ vqs7mxfC/V8JEoBBaMqz+erqRkc1Y2z9n6CDpVtZbwjpmL1OmvJSWwMVgcX4O4MS0sEDLRuZQ PG0hjewIGad3zPeLkqr3ODMMoxa28ZkNfli0iEIb6nx17N5kD5zkRTGSWFWgYv9B+NViRNraQ 2L5w0+1ASg3Agp0sZbEoYpPAY/9TsX4ZoWykV/5XwwulAdphRXrtQ8sh6vL669RXHBT7mcCqO GKpHTyuLOGi/xSERhPYKF6k8frHFnHYai7hXltH7AZehQpPWyHXk0aAgcriRnnKJZijfrZw4J GP5jplwYqEfbAAbi/eczNT6MpoXmrCGcPjiPGLybwsLbJ7tzlzDiTT5d8pj5k6NoVP8G7+O5c Tb+dPoCc4Fem5aAw0v+aOI/Yf7mmYprmPPXoX7bLo+xB3jRmkkcldr5Wp8nkL/LI8n1UqNv2b 1NOQmfSBxNbxGJr4ejJ+9sAJvzd3twulCkUCnZ+aZYC7nD116HDZvthsDzvy3JKcFCzO4Ns49 f0H1j7YIXQdSqpbudI3UxO+HWRAfiQ2BFdHkQ8+QLsbPXp0tNEPm65N4sbZTBUglJjsVvPk1H 3QF8pLnoUIGb48MZwdOyG/JsFFNQZZ6noD4nyL+nffQotoEzDCv6sP6CwoL1vGh4otPdGYL2J HyOf4S90MNAE9x9Anzs9HS+C6YsGK4xUPC3+VAZJPuXMT+oa6M= Subject: [Intel-gfx] [PATCH 2/3] drm/i915: work around false-positive maybe-uninitialized warning X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, Arnd Bergmann , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, Chris Wilson , Matthew Auld Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" gcc-9 gets confused by the code flow in check_dirty_whitelist: drivers/gpu/drm/i915/gt/selftest_workarounds.c: In function 'check_dirty_whitelist': drivers/gpu/drm/i915/gt/selftest_workarounds.c:492:17: error: 'rsvd' may be used uninitialized in this function [-Werror=maybe-uninitialized] I could not figure out a good way to do this in a way that gcc understands better, so initialize the variable to zero, as last resort. Fixes: aee20aaed887 ("drm/i915: Implement read-only support in whitelist selftest") Signed-off-by: Arnd Bergmann Reviewed-by: Chris Wilson --- drivers/gpu/drm/i915/gt/selftest_workarounds.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/i915/gt/selftest_workarounds.c b/drivers/gpu/drm/i915/gt/selftest_workarounds.c index 5ed323254ee1..32785463ec9e 100644 --- a/drivers/gpu/drm/i915/gt/selftest_workarounds.c +++ b/drivers/gpu/drm/i915/gt/selftest_workarounds.c @@ -623,6 +623,8 @@ static int check_dirty_whitelist(struct intel_context *ce) err = -EINVAL; goto out_unpin; } + } else { + rsvd = 0; } expect = results[0]; From patchwork Wed May 27 14:05:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11573091 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7A17990 for ; Wed, 27 May 2020 14:11:12 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 63054207D8 for ; Wed, 27 May 2020 14:11:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 63054207D8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arndb.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F00FB6E0BE; Wed, 27 May 2020 14:11:11 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.130]) by gabe.freedesktop.org (Postfix) with ESMTPS id BD4426E0BE for ; Wed, 27 May 2020 14:11:09 +0000 (UTC) Received: from threadripper.lan ([149.172.98.151]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1Mo6WJ-1jFYx33Vox-00pcRT; Wed, 27 May 2020 16:05:42 +0200 From: Arnd Bergmann To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , Mika Kuoppala , Chris Wilson Date: Wed, 27 May 2020 16:05:10 +0200 Message-Id: <20200527140526.1458215-3-arnd@arndb.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527140526.1458215-1-arnd@arndb.de> References: <20200527140526.1458215-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:Bs1kH9SiEUr82+i0D5b4IjNzyMWhRc9ReAI4hRbtaSg+wd4Y+kE gsHtJL0netn243C7nHQamvh/2VpFFj/mbWQZYBUlmk15Ur8+KyRpRLNWTSOpnSXrG6ACa8Y a50vkShJOWxV4ykm7XUMk0pidxZYJm1W5/Zw9bnILBSY8qbgoV8/N+o6gDRiA7eO91pvrsn zFA51RKJXl5UhRluoBa/w== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:c5DWn25j260=:KTuaEkXe9joHeC1qL4bnbv AAPf/MF/iOgYsstMfVx3Y39U9FXX3MwIL9DH3neqbbW2GzZABNkgyuA54qdq2/j15k6HxFIaM 9HbUQDH2lI6hqadbA5fJHZWLj87/xW7us6+jelhJAHGB5ofO9MLj70aqt2pah+in+fC6H7XOj AfezqkVVSeBDzKcPGP/FBPudBw3EdzE44t2oMYQSH1yqvZXbovbgrL2UNID7UrNWrOx3kgz0/ kl7xkF3MRkx4UpWusgs6pdpB8NdclqEWmSXam5MBnJ0hd+5q8JiDRS1F+8ma0lkQKchwcb0ZE pcBbOPd5hgrnOSsBi1xwvY4Ui4F5bJZaHLNq8yD08+0tbWxOkpPEuItlzz0Fp87CLwzM20Rcf UxSAYjmWO7x61VJVR+EHnEsa91f1LLvESd8um41t1e3b8Hr/V/xgvOYJbBgP3LJmR7AuqLz/G 9Z8BSQQgClvnzU1hQH5MkZQSK/TKgUc4i4ZhFZSGDeaEqFSoYOYguTxNHJrAqkOMnngWuhV/j DlooDLaMYzAIChSaUN4JtAbON5Y3Y5s6IH8Wg6V0mg9TVMxEO1EMc0QMzXh90YXJDFL4BvXI+ MK+i6kfCPt7SgGlKbCgiljzHseNp/DKIsoc2FVl2m0OD5ekQTuXbuHk0hd0viJlS78e7av5HJ JzLhIvFfEUO4Sq5bY3z3ROWcIhoQ+hFHM1oHGN+302OEtWCkFGFtPcaubndbZLFutVEGzg0dh rnrzxnxB1s2R4T/ff0fRDSCxnxErSlUs0ZR0fXvQdihwVVQUUH9qxrcG0B0b9bghC6qd9GzhG uMrja3O/m8aDaDLRaaxNXpoIGZWB1jR+T2J7oMXncsqJJ844Bc= Subject: [Intel-gfx] [PATCH 3/3] drm/i915/selftests: avoid bogus maybe-uninitialized warning X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Matthew Auld Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" gcc has a problem following values through IS_ERR/PTR_ERR macros, leading to a false-positive warning in allmodconfig, with any compiler version: In file included from drivers/gpu/drm/i915/gt/intel_lrc.c:5892: drivers/gpu/drm/i915/gt/selftest_lrc.c: In function 'create_gpr_client.isra.0': drivers/gpu/drm/i915/gt/selftest_lrc.c:2902:23: error: 'rq' may be used uninitialized in this function [-Werror=maybe-uninitialized] This one is hard to avoid without impairing readability or adding a bugus NULL pointer. Fixes: c92724de6db1 ("drm/i915/selftests: Try to detect rollback during batchbuffer preemption") Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/i915/gt/selftest_lrc.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/selftest_lrc.c b/drivers/gpu/drm/i915/gt/selftest_lrc.c index 824f99c4cc7c..933c3f5adf0a 100644 --- a/drivers/gpu/drm/i915/gt/selftest_lrc.c +++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c @@ -2908,23 +2908,25 @@ create_gpr_client(struct intel_engine_cs *engine, vma = i915_vma_instance(global->obj, ce->vm, NULL); if (IS_ERR(vma)) { - err = PTR_ERR(vma); + rq = ERR_CAST(vma); goto out_ce; } err = i915_vma_pin(vma, 0, 0, PIN_USER); - if (err) + if (err) { + rq = ERR_PTR(err); goto out_ce; + } batch = create_gpr_user(engine, vma, offset); if (IS_ERR(batch)) { - err = PTR_ERR(batch); + rq = ERR_CAST(batch); goto out_vma; } rq = intel_context_create_request(ce); if (IS_ERR(rq)) { - err = PTR_ERR(rq); + rq = ERR_CAST(rq); goto out_batch; } @@ -2946,17 +2948,20 @@ create_gpr_client(struct intel_engine_cs *engine, i915_vma_unlock(batch); i915_vma_unpin(batch); - if (!err) + if (!err) { i915_request_get(rq); - i915_request_add(rq); - + i915_request_add(rq); + } else { + i915_request_add(rq); + rq = ERR_PTR(err); + } out_batch: i915_vma_put(batch); out_vma: i915_vma_unpin(vma); out_ce: intel_context_put(ce); - return err ? ERR_PTR(err) : rq; + return rq; } static int preempt_user(struct intel_engine_cs *engine,