From: SF Markus Elfring <elfring@users.sourceforge.net>
To: dri-devel@lists.freedesktop.org,
linux-renesas-soc@vger.kernel.org,
David Airlie <airlied@linux.ie>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 1/2] drm/rcar-du: Use common error handling code in rcar_du_encoders_init()
Date: Tue, 24 Oct 2017 18:01:21 +0200 [thread overview]
Message-ID: <9fafa688-f699-c587-ef77-840efa71bf76@users.sourceforge.net> (raw)
In-Reply-To: <7d5e68c7-2d64-0131-1a08-eeb4e03cc113@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 24 Oct 2017 17:16: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/rcar-du/rcar_du_kms.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index 566d1a948c8f..d2c80cc9f8ee 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -377,10 +377,8 @@ static int rcar_du_encoders_init(struct rcar_du_device *rcdu)
int ret;
ret = of_graph_parse_endpoint(ep_node, &ep);
- if (ret < 0) {
- of_node_put(ep_node);
- return ret;
- }
+ if (ret < 0)
+ goto put_node;
/* Find the output route corresponding to the port number. */
for (i = 0; i < RCAR_DU_OUTPUT_MAX; ++i) {
@@ -401,10 +399,8 @@ static int rcar_du_encoders_init(struct rcar_du_device *rcdu)
/* Process the output pipeline. */
ret = rcar_du_encoders_init_one(rcdu, output, &ep);
if (ret < 0) {
- if (ret == -EPROBE_DEFER) {
- of_node_put(ep_node);
- return ret;
- }
+ if (ret == -EPROBE_DEFER)
+ goto put_node;
continue;
}
@@ -413,6 +409,10 @@ static int rcar_du_encoders_init(struct rcar_du_device *rcdu)
}
return num_encoders;
+
+put_node:
+ of_node_put(ep_node);
+ return ret;
}
static int rcar_du_properties_init(struct rcar_du_device *rcdu)
--
2.14.3
next prev parent reply other threads:[~2017-10-24 16:01 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-24 16:00 [PATCH 0/2] R-Car Display Unit: Fine-tuning for some function implementations SF Markus Elfring
2017-10-24 16:01 ` SF Markus Elfring [this message]
2017-10-25 6:01 ` [PATCH 1/2] drm/rcar-du: Use common error handling code in rcar_du_encoders_init() Dan Carpenter
2017-10-25 6:35 ` Clarification for approaches around exception handling SF Markus Elfring
2017-10-26 12:40 ` [PATCH 1/2] drm/rcar-du: Use common error handling code in rcar_du_encoders_init() kbuild test robot
2017-11-01 15:38 ` [PATCH v2 0/2] R-Car Display Unit: Fine-tuning for some function implementations SF Markus Elfring
2017-11-01 15:39 ` [PATCH v2 1/2] drm/rcar-du: Use common error handling code in rcar_du_encoders_init() SF Markus Elfring
2017-11-01 15:41 ` [PATCH v2 2/2] drm/rcar-du: Adjust 14 checks for null pointers SF Markus Elfring
2017-10-27 18:45 ` [PATCH 1/2] drm/rcar-du: Use common error handling code in rcar_du_encoders_init() Jani Nikula
2017-10-29 11:01 ` Geert Uytterhoeven
2017-10-29 17:12 ` Laurent Pinchart
2017-10-29 18:19 ` SF Markus Elfring
2017-10-30 9:52 ` [PATCH 1/2] " Jani Nikula
2017-10-30 10:03 ` SF Markus Elfring
2017-10-30 13:18 ` [PATCH 1/2] " Laurent Pinchart
2017-10-24 16:02 ` [PATCH 2/2] drm/rcar-du: Adjust 14 checks for null pointers SF Markus Elfring
2017-10-25 6:02 ` Dan Carpenter
2017-10-25 6:44 ` SF Markus Elfring
2017-10-25 7:32 ` Dan Carpenter
2017-10-25 7:39 ` Unicode characters in commit messages? SF Markus Elfring
2017-10-25 8:43 ` Dan Carpenter
2017-10-25 9:16 ` 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=9fafa688-f699-c587-ef77-840efa71bf76@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
/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
Powered by JetHome