From patchwork Fri Feb 17 06:10:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 9578837 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 BB0E6600F6 for ; Fri, 17 Feb 2017 06:11:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9CC53286A4 for ; Fri, 17 Feb 2017 06:11:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9018D28696; Fri, 17 Feb 2017 06:11: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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham 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 3490B28696 for ; Fri, 17 Feb 2017 06:11:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752681AbdBQGLr (ORCPT ); Fri, 17 Feb 2017 01:11:47 -0500 Received: from mail-it0-f66.google.com ([209.85.214.66]:35221 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751493AbdBQGLq (ORCPT ); Fri, 17 Feb 2017 01:11:46 -0500 Received: by mail-it0-f66.google.com with SMTP id 203so1211799ith.2; Thu, 16 Feb 2017 22:11:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=yzKKP7hkMZc297i/KKIEddWVi6J6axBugNyt2E1cBL0=; b=hjboiXD6c9gViVwNq85RNPNXa9D0ZP1C/687568QasY9omxVoGq6ofCEZqFRW9yC34 6ouN93svE6qIA432k29qgpwlMeVqplBJiSS186wYeKlOYf6Io37VpKL6ylmCCF3VnMzn AlP5e1DNXWaZKtONdKO/P13z6pKPNi583nFLI7Aooh6Qk+FGpzot4jRjtnXYQ0lfe3Bs dTesPgQUGHXYqTxg9SKZYDwzA6FoTHzevD9rib7lEZCr0no9PRZQt4wJuUqIeSV6UpYj 45VtmEKSUxsoffza6g+kxdcH16Mq/esylBYM5FUGMhwnmTkdULU7X4oao3jzPldhNv6X Q6tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=yzKKP7hkMZc297i/KKIEddWVi6J6axBugNyt2E1cBL0=; b=s5lPvv9wn6Da1UnSRIFrRDTju0tiTzlhwDVnyiefvLhi4LO6L+1SowfyuBvNKyey/m Vn8w9xEMG2+Yrti/El6dqZ/BxDHE9toMYHcmuvctzF11m9QKNApzUk0LaBlx/nJ3zgXi KU0UeDliFowUq5lS+dya+5TEpruuqK7XiRtBm1UK008YSXsN1x49wCb/5sTxx+zGOsbm RbbfvifkpyOdWeFiLHG00zwr2WTSr+Ss2hKnOQgxxjlYKf6bIDJlVdpVWpjXtB4YA7K8 ZFX2aX8hM/9/B66jGS2IKCaqT4TALb5gmUNYlHWb92LYm7NjzUUWVlDh2I6PjQJnEmov FLow== X-Gm-Message-State: AMke39l2fBa+1ss0LwAI0RkRlKqyRmE++CcaggVZgAeIXbgOMVHxr5BgcmqlHW8VGte96g== X-Received: by 10.36.53.210 with SMTP id k201mr758986ita.21.1487311905292; Thu, 16 Feb 2017 22:11:45 -0800 (PST) Received: from symbol-HP-Z420-Workstation.zebra.lan ([223.31.70.102]) by smtp.googlemail.com with ESMTPSA id o13sm174400ith.5.2017.02.16.22.11.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Feb 2017 22:11:44 -0800 (PST) From: Arvind Yadav To: tomi.valkeinen@ti.com, b.zolnierkie@samsung.com Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] omapfb: dss: Handle return error in dss_init_ports. Date: Fri, 17 Feb 2017 11:40:27 +0530 Message-Id: <1487311827-15644-1-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. - Trying to get port initalization successful. Changes in v2: - handle cleanup of partially initialized ports. --- drivers/video/fbdev/omap2/omapfb/dss/dss.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss.c b/drivers/video/fbdev/omap2/omapfb/dss/dss.c index 47d7f69..2b1e5c6 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/dss.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/dss.c @@ -114,6 +114,8 @@ struct dss_features { static bool dss_initialized; +static void dss_uninit_ports(struct platform_device *pdev); + bool omapdss_is_initialized(void) { return dss_initialized; @@ -946,6 +948,7 @@ static int dss_init_ports(struct platform_device *pdev) struct device_node *parent = pdev->dev.of_node; struct device_node *port; int r; + int ret = 0; if (parent == NULL) return 0; @@ -972,17 +975,24 @@ static int dss_init_ports(struct platform_device *pdev) switch (port_type) { case OMAP_DISPLAY_TYPE_DPI: - dpi_init_port(pdev, port); + ret = dpi_init_port(pdev, port); + if (ret) + continue; break; case OMAP_DISPLAY_TYPE_SDI: - sdi_init_port(pdev, port); + ret = sdi_init_port(pdev, port); + if (ret) + continue; break; default: break; } } while ((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)