From patchwork Mon Mar 14 14:22:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102592 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp66048lbc; Mon, 14 Mar 2016 07:23:10 -0700 (PDT) X-Received: by 10.66.132.73 with SMTP id os9mr38559270pab.27.1457965389929; Mon, 14 Mar 2016 07:23:09 -0700 (PDT) Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTP id vx8si12450847pac.107.2016.03.14.07.23.09; Mon, 14 Mar 2016 07:23:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C1D766E105; Mon, 14 Mar 2016 14:23:06 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.74]) by gabe.freedesktop.org (Postfix) with ESMTPS id 293136E105 for ; Mon, 14 Mar 2016 14:23:03 +0000 (UTC) Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0Mgegh-1aQqx11qMx-00NzdR; Mon, 14 Mar 2016 15:22:52 +0100 From: Arnd Bergmann To: Inki Dae , David Airlie Subject: [PATCH] drm/exynos: fix error handling in exynos_drm_subdrv_open Date: Mon, 14 Mar 2016 15:22:25 +0100 Message-Id: <1457965368-3271060-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:urZqTVjQTJLz9codHoQm+fs2EXceJ5WGKSNkUBvsq1vwYKz2I8z XBQUCKNF670rh+u8fuolQ9CD24+kmXqP3fpkn4O0j0PrUm6goMPuL7QP68+zUclkX6LMqzb ZUAthkywCidIq4tMuztcWSoEGJu8O2uCx7qEWd7UUAC2Z7cS1eCZt/ns5Gzp75MdkERwxPJ MzalhBAqGuBdM5Hzkn7zQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:4wL2JB2kvcw=:nBa4N47zdRQSWeReq2OJf6 B0ZFA0rVN39yASQygqBkMiBwJRVLTHug/nSBNWoY9CiGdGwigqaLSMWsndlocNcOG6Z7LpgpP 7kZxUjM/Mnh5xSeOgXAhGnFqDgauMjmJiixBaCB2ICDdcgUku//jOOgZL28lv4C61YxPOERsU 0XFAKce84WCqbpv8JspRZsF+FTmfqwvAmhIEhQxnyGo470ypraNNGnAegjyS5DjypVJvFcF72 YHt/anvHYD2sUXRGoeTJHytoaXsHMBRgViItZDUk/gNOZI1uoaoVxKXJ8p/YpiFLKki5oB7XC qJA8xrZUa9K84k+xOLjHNNljCBuTMyU8TG232VpWYumVQfvoNeb94hPQubBYalh07DTwoLXeC 8Szr/nvsWsAuLkXrqG9sFuJJ6Tg3E0kgYICBOsNK+7b+v4KwcZ9EZc8xiZOR0K8+8nHTscLKt qq2bkhwoYKF9xVmm5tckdV4QMNQmaZlb/aLZT9IqUdcWFtny8HI4mKTjOTsfkVz/qr4knxoCB jTb00XyZFn0rZuTb81WYmB0J08Ff37AOZIAdQD/krk8i2lu4ph+6qC3VNESMdYCkLCZUNq4AN cxAZAtNxAq91avrt5jBM6yG/t5k0x3Mnw9f5mvaWiI6t6nrtl8TkP/dQgsPnuPjMx0PdDwpQS OB1lFLiF1RqVbawPU6LN0aZZTjk7yrrzQDOxkfAY89I3ApSSUnEzXr/kdKMYVpmLhrw8= Cc: Krzysztof Kozlowski , linux-samsung-soc@vger.kernel.org, Arnd Bergmann , Seung-Woo Kim , linux-kernel@vger.kernel.org, Kyungmin Park , Kukjin Kim , dri-devel@lists.freedesktop.org, Gustavo Padovan , linux-arm-kernel@lists.infradead.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" gcc-6 warns about a pointless loop in exynos_drm_subdrv_open: drivers/gpu/drm/exynos/exynos_drm_core.c: In function 'exynos_drm_subdrv_open': drivers/gpu/drm/exynos/exynos_drm_core.c:104:199: error: self-comparison always evaluates to false [-Werror=tautological-compare] list_for_each_entry_reverse(subdrv, &subdrv->list, list) { Here, the list_for_each_entry_reverse immediately terminates because the subdrv pointer is compared to itself as the loop end condition. If we were to take the current subdrv pointer as the start of the list (as we would do if list_for_each_entry_reverse() was not a macro), we would iterate backwards over the &exynos_drm_subdrv_list anchor, which would be even worse. Instead, we need to use list_for_each_entry_continue_reverse() to go back over each subdrv that was successfully opened until the first entry. Signed-off-by: Arnd Bergmann Fixes: 9084f7b8a577 ("drm/exynos: add subdrv open/close functions") --- drivers/gpu/drm/exynos/exynos_drm_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c index 7f55ba6771c6..011211e4167d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_core.c +++ b/drivers/gpu/drm/exynos/exynos_drm_core.c @@ -101,7 +101,7 @@ int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file) return 0; err: - list_for_each_entry_reverse(subdrv, &subdrv->list, list) { + list_for_each_entry_continue_reverse(subdrv, &exynos_drm_subdrv_list, list) { if (subdrv->close) subdrv->close(dev, subdrv->dev, file); }