From patchwork Mon Mar 20 16:38:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 9634521 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 EA62760327 for ; Mon, 20 Mar 2017 16:44:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC34A27C0B for ; Mon, 20 Mar 2017 16:44:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE08C2843F; Mon, 20 Mar 2017 16:44:36 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C06927C0C for ; Mon, 20 Mar 2017 16:44:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755447AbdCTQmo (ORCPT ); Mon, 20 Mar 2017 12:42:44 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:49711 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754024AbdCTQmI (ORCPT ); Mon, 20 Mar 2017 12:42:08 -0400 Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0ON402ZVWGWWUF40@mailout3.samsung.com>; Tue, 21 Mar 2017 01:38:56 +0900 (KST) Received: from epsmges5p3.samsung.com (unknown [182.195.42.46]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20170320163855epcas5p1c7c56e558d546b54c8206d14d8b416a8~tpINKuHJY1448314483epcas5p1x; Mon, 20 Mar 2017 16:38:55 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p3.samsung.com (EPCPMTA) with SMTP id 24.4B.04781.F9500D85; Tue, 21 Mar 2017 01:38:55 +0900 (KST) Received: from epcpsbgm2new.samsung.com (u27.gpu120.samsung.co.kr [203.254.230.27]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20170320163854epcas5p461f776427a0c7c4a885a712a72e43428~tpIMHAHT-0425104251epcas5p42; Mon, 20 Mar 2017 16:38:54 +0000 (GMT) X-AuditID: b6c32a2e-f79d66d0000012ad-17-58d0059f0bf4 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 43.E1.06422.E9500D85; Tue, 21 Mar 2017 01:38:54 +0900 (KST) Received: from amdc3058.localnet ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ON400CBFGWSJXC0@mmp2.samsung.com>; Tue, 21 Mar 2017 01:38:54 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Arvind Yadav Cc: tomi.valkeinen@ti.com, linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] omapfb: dss: Handle return error in dss_init_ports. Date: Mon, 20 Mar 2017 17:38:51 +0100 Message-id: <1628164.x9NLckFqdM@amdc3058> User-Agent: KMail/4.13.3 (Linux/3.13.0-96-generic; KDE/4.13.3; x86_64; ; ) In-reply-to: <1487311827-15644-1-git-send-email-arvind.yadav.cs@gmail.com> MIME-version: 1.0 Content-transfer-encoding: 7Bit Content-type: text/plain; charset=us-ascii X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDIsWRmVeSWpSXmKPExsWy7bCmuu581gsRBkdXy1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/dbCXPBFomLZpgtM DYxTRLoYOTkkBEwkVmw5wAZhi0lcuLceyObiEBKYxSjxr7eLBcL5yijRsHYCK0gVm4CVxMT2 VYwgtoiAjsSmmb/BbGaBIokN086BTRIW8JaYsfUcE4jNIqAq8ahnAXMXIwcHr4CmxP7V/iBh UQEviS372plAwpxAdmNzEcSq+YwSb2YuAhvDKyAo8WPyPRaI8fIS+/ZPZYWwtSTW7zzONIER 6EqEsllIymYhKVvAyLyKUSK1ILmgOCk91ygvtVyvODG3uDQvXS85P3cTIzh2nknvYDy8y/0Q owAHoxIP74or5yOEWBPLiitzDzFKcDArifBWvQQK8aYkVlalFuXHF5XmpBYfYjQF+m8is5Ro cj4wrvNK4g1NzE3MjQ0szC0tTYyUxHkbZz8LFxJITyxJzU5NLUgtgulj4uCUamCc4MroeObB 1LVvFYyaKz7u5jCWtzlbe2fKTQllEdbAH96718r0qjZ2HnxgFrDn06HVD08qlvfXrOdj5ri6 89mCs0u/r9y27Lz7pTflJe6ypme8NhlvfOaZXp6ylOum980G7m+ODsJS8xaaFk/3qm7YtKZr 8oOyjws99P1NfK+l/Srtrfkt+9VJiaU4I9FQi7moOBEA/jqFkLMCAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170320163854epcas5p461f776427a0c7c4a885a712a72e43428 X-Msg-Generator: CA X-Sender-IP: 203.254.230.27 X-Local-Sender: =?UTF-8?B?QmFydGxvbWllaiBab2xuaWVya2lld2ljehtTUlBPTC1LZXJu?= =?UTF-8?B?ZWwgKFRQKRvsgrzshLHsoITsnpAbU2VuaW9yIFNvZnR3YXJlIEVuZ2luZWVy?= X-Global-Sender: =?UTF-8?B?QmFydGxvbWllaiBab2xuaWVya2lld2ljehtTUlBPTC1LZXJu?= =?UTF-8?B?ZWwgKFRQKRtTYW1zdW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBF?= =?UTF-8?B?bmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 105P X-HopCount: 7 X-CMS-RootMailID: 20170217061504epcas4p1ca29ea6ab098359de52d547c4fe7cd11 X-RootMTR: 20170217061504epcas4p1ca29ea6ab098359de52d547c4fe7cd11 References: <1487311827-15644-1-git-send-email-arvind.yadav.cs@gmail.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, On Friday, February 17, 2017 11:40:27 AM Arvind Yadav wrote: > Here, dss_init_ports is not handling return error form > dpi_init_port and sdi_init_port. Now dss_init_ports is returning > always 0. And it's making below code as a dead code. > > static int dss_bind(struct device *dev) > { > . > . > r = dss_init_ports(pdev); //dss_init_ports will return always 0 > if (r)// This condition will always false > goto err_init_ports; //Dead Code > . > . > } > > This change is to handle return error from dpi_init_port and > sdi_init_port. Also, It will remove dead code from function 'dss_bind'. > > Signed-off-by: Arvind Yadav > > Changes in v3: > -We should not stop initialization after port init fails. This is what v2 did and v3 still does. I asked about stopping the initialization after the first failure. Anyway, I fixed this and queued the patch for 4.12 (the updated version is attached to this mail for reference), thanks! Best regards, --- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics From: Arvind Yadav Subject: [PATCH] omapfb: dss: Handle return errors in dss_init_ports() dss_init_ports() is not handling return errors from dpi_init_port() and sdi_init_port(). It is also always returning 0 currently which results in part of error handling code in dss_bind() being unused. Fix dss_init_ports() to handle return errors from dpi_init_port() and sdi_init_port(). Signed-off-by: Arvind Yadav Cc: tomi.valkeinen@ti.com [b.zolnierkie: fail early on errors, minor fixups] Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/omap2/omapfb/dss/dss.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: b/drivers/video/fbdev/omap2/omapfb/dss/dss.c =================================================================== --- a/drivers/video/fbdev/omap2/omapfb/dss/dss.c 2017-03-20 17:24:24.387753929 +0100 +++ b/drivers/video/fbdev/omap2/omapfb/dss/dss.c 2017-03-20 17:32:32.767766228 +0100 @@ -941,11 +941,13 @@ static int dss_init_features(struct plat return 0; } +static void dss_uninit_ports(struct platform_device *pdev); + static int dss_init_ports(struct platform_device *pdev) { struct device_node *parent = pdev->dev.of_node; struct device_node *port; - int r; + int r, ret = 0; if (parent == NULL) return 0; @@ -972,17 +974,21 @@ static int dss_init_ports(struct platfor switch (port_type) { case OMAP_DISPLAY_TYPE_DPI: - dpi_init_port(pdev, port); + ret = dpi_init_port(pdev, port); break; case OMAP_DISPLAY_TYPE_SDI: - sdi_init_port(pdev, port); + ret = sdi_init_port(pdev, port); break; default: break; } - } while ((port = omapdss_of_get_next_port(parent, port)) != NULL); + } while (!ret && + (port = omapdss_of_get_next_port(parent, port)) != NULL); - return 0; + if (ret) + dss_uninit_ports(pdev); + + return ret; } static void dss_uninit_ports(struct platform_device *pdev)