All of lore.kernel.org
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org,
	David Airlie <airlied@linux.ie>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Thierry Reding <thierry.reding@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 1/2] drm/tegra: Use common error handling code in tegra_output_probe()
Date: Tue, 24 Oct 2017 19:34:14 +0200	[thread overview]
Message-ID: <f9cc525e-7367-f4d8-d41f-dd35ce9a2c34@users.sourceforge.net> (raw)
In-Reply-To: <bfac49e0-8948-e62f-1876-567605f1e2c8@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 24 Oct 2017 19:12:09 +0200

Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/gpu/drm/tegra/output.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c
index 595d1ec3e02e..1e0915e213b4 100644
--- a/drivers/gpu/drm/tegra/output.c
+++ b/drivers/gpu/drm/tegra/output.c
@@ -139,8 +139,7 @@ int tegra_output_probe(struct tegra_output *output)
 		err = gpio_to_irq(output->hpd_gpio);
 		if (err < 0) {
 			dev_err(output->dev, "gpio_to_irq(): %d\n", err);
-			gpio_free(output->hpd_gpio);
-			return err;
+			goto free_gpio;
 		}
 
 		output->hpd_irq = err;
@@ -153,8 +152,7 @@ int tegra_output_probe(struct tegra_output *output)
 		if (err < 0) {
 			dev_err(output->dev, "failed to request IRQ#%u: %d\n",
 				output->hpd_irq, err);
-			gpio_free(output->hpd_gpio);
-			return err;
+			goto free_gpio;
 		}
 
 		output->connector.polled = DRM_CONNECTOR_POLL_HPD;
@@ -168,6 +166,10 @@ int tegra_output_probe(struct tegra_output *output)
 	}
 
 	return 0;
+
+free_gpio:
+	gpio_free(output->hpd_gpio);
+	return err;
 }
 
 void tegra_output_remove(struct tegra_output *output)
-- 
2.14.3

WARNING: multiple messages have this Message-ID (diff)
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org,
	David Airlie <airlied@linux.ie>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Thierry Reding <thierry.reding@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 1/2] drm/tegra: Use common error handling code in tegra_output_probe()
Date: Tue, 24 Oct 2017 17:34:14 +0000	[thread overview]
Message-ID: <f9cc525e-7367-f4d8-d41f-dd35ce9a2c34@users.sourceforge.net> (raw)
In-Reply-To: <bfac49e0-8948-e62f-1876-567605f1e2c8@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 24 Oct 2017 19:12:09 +0200

Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/gpu/drm/tegra/output.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c
index 595d1ec3e02e..1e0915e213b4 100644
--- a/drivers/gpu/drm/tegra/output.c
+++ b/drivers/gpu/drm/tegra/output.c
@@ -139,8 +139,7 @@ int tegra_output_probe(struct tegra_output *output)
 		err = gpio_to_irq(output->hpd_gpio);
 		if (err < 0) {
 			dev_err(output->dev, "gpio_to_irq(): %d\n", err);
-			gpio_free(output->hpd_gpio);
-			return err;
+			goto free_gpio;
 		}
 
 		output->hpd_irq = err;
@@ -153,8 +152,7 @@ int tegra_output_probe(struct tegra_output *output)
 		if (err < 0) {
 			dev_err(output->dev, "failed to request IRQ#%u: %d\n",
 				output->hpd_irq, err);
-			gpio_free(output->hpd_gpio);
-			return err;
+			goto free_gpio;
 		}
 
 		output->connector.polled = DRM_CONNECTOR_POLL_HPD;
@@ -168,6 +166,10 @@ int tegra_output_probe(struct tegra_output *output)
 	}
 
 	return 0;
+
+free_gpio:
+	gpio_free(output->hpd_gpio);
+	return err;
 }
 
 void tegra_output_remove(struct tegra_output *output)
-- 
2.14.3


  reply	other threads:[~2017-10-24 17:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-24 17:33 [PATCH 0/2] GPU-DRM-Tegra: Fine-tuning for tegra_output_probe() SF Markus Elfring
2017-10-24 17:33 ` SF Markus Elfring
2017-10-24 17:33 ` SF Markus Elfring
2017-10-24 17:34 ` SF Markus Elfring [this message]
2017-10-24 17:34   ` [PATCH 1/2] drm/tegra: Use common error handling code in tegra_output_probe() SF Markus Elfring
2017-10-24 17:35 ` [PATCH 2/2] drm/tegra: Use an error code directly " SF Markus Elfring
2017-10-24 17:35   ` SF Markus Elfring

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=f9cc525e-7367-f4d8-d41f-dd35ce9a2c34@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jonathanh@nvidia.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=thierry.reding@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.