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: 8579571 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 435B99F6E1 for ; Mon, 14 Mar 2016 14:23:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 55D1420377 for ; Mon, 14 Mar 2016 14:23:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CADB9203ED for ; Mon, 14 Mar 2016 14:23:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932102AbcCNOXe (ORCPT ); Mon, 14 Mar 2016 10:23:34 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:54007 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753750AbcCNOXd (ORCPT ); Mon, 14 Mar 2016 10:23:33 -0400 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 Cc: Arnd Bergmann , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Kukjin Kim , Krzysztof Kozlowski , Gustavo Padovan , Daniel Kurtz , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org 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= Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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); }