linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arvind Yadav <arvind.yadav.cs@gmail.com>
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 06:22:27 +0000	[thread overview]
Message-ID: <1487311827-15644-1-git-send-email-arvind.yadav.cs@gmail.com> (raw)

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 <arvind.yadav.cs@gmail.com>

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)
-- 
1.9.1


             reply	other threads:[~2017-02-17  6:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170217061504epcas4p1ca29ea6ab098359de52d547c4fe7cd11@epcas4p1.samsung.com>
2017-02-17  6:22 ` Arvind Yadav [this message]
2017-03-20 16:38   ` [PATCH v3] omapfb: dss: Handle return error in dss_init_ports Bartlomiej Zolnierkiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1487311827-15644-1-git-send-email-arvind.yadav.cs@gmail.com \
    --to=arvind.yadav.cs@gmail.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).