* [PATCH 0/2] GPU-DRM-Tegra: Fine-tuning for tegra_output_probe()
@ 2017-10-24 17:33 SF Markus Elfring
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
0 siblings, 2 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-10-24 17:33 UTC (permalink / raw)
To: dri-devel, linux-tegra, David Airlie, Jonathan Hunter, Thierry Reding
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 24 Oct 2017 19:29:39 +0200
Two update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Use common error handling code
Use an error code directly
drivers/gpu/drm/tegra/output.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
--
2.14.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] drm/tegra: Use common error handling code in tegra_output_probe()
2017-10-24 17:33 [PATCH 0/2] GPU-DRM-Tegra: Fine-tuning for tegra_output_probe() SF Markus Elfring
@ 2017-10-24 17:34 ` SF Markus Elfring
2017-10-24 17:35 ` [PATCH 2/2] drm/tegra: Use an error code directly " SF Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-10-24 17:34 UTC (permalink / raw)
To: dri-devel, linux-tegra, David Airlie, Jonathan Hunter, Thierry Reding
Cc: LKML, kernel-janitors
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
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 2/2] drm/tegra: Use an error code directly in tegra_output_probe()
2017-10-24 17:33 [PATCH 0/2] GPU-DRM-Tegra: Fine-tuning for tegra_output_probe() SF Markus Elfring
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 ` SF Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-10-24 17:35 UTC (permalink / raw)
To: dri-devel, linux-tegra, David Airlie, Jonathan Hunter, Thierry Reding
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 24 Oct 2017 19:21:24 +0200
Return the code "-EPROBE_DEFER" directly in one if branch
without assigning it to the local variable "err" before.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/gpu/drm/tegra/output.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c
index 1e0915e213b4..a9b458f22de6 100644
--- a/drivers/gpu/drm/tegra/output.c
+++ b/drivers/gpu/drm/tegra/output.c
@@ -115,9 +115,8 @@ int tegra_output_probe(struct tegra_output *output)
if (ddc) {
output->ddc = of_find_i2c_adapter_by_node(ddc);
if (!output->ddc) {
- err = -EPROBE_DEFER;
of_node_put(ddc);
- return err;
+ return -EPROBE_DEFER;
}
of_node_put(ddc);
--
2.14.3
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-24 17:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-24 17:33 [PATCH 0/2] GPU-DRM-Tegra: Fine-tuning for tegra_output_probe() SF Markus Elfring
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome