From: Javier Carrasco <javier.carrasco.cruz@gmail.com>
To: Paul Kocialkowski <paul.kocialkowski@bootlin.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Javier Carrasco <javier.carrasco.cruz@gmail.com>
Subject: [PATCH 3/3] drm: logicvc: use automatic cleanup facility for layers_node
Date: Fri, 11 Oct 2024 01:11:10 +0200 [thread overview]
Message-ID: <20241011-logicvc_layer_of_node_put-v1-3-1ec36bdca74f@gmail.com> (raw)
In-Reply-To: <20241011-logicvc_layer_of_node_put-v1-0-1ec36bdca74f@gmail.com>
Use the more robust approach provided by the __free() macro to
automatically call of_node_put() when the device node goes out of scope.
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
drivers/gpu/drm/logicvc/logicvc_layer.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/logicvc/logicvc_layer.c b/drivers/gpu/drm/logicvc/logicvc_layer.c
index 34caf5f0f619..9d7d1b58b002 100644
--- a/drivers/gpu/drm/logicvc/logicvc_layer.c
+++ b/drivers/gpu/drm/logicvc/logicvc_layer.c
@@ -581,12 +581,12 @@ int logicvc_layers_init(struct logicvc_drm *logicvc)
struct drm_device *drm_dev = &logicvc->drm_dev;
struct device *dev = drm_dev->dev;
struct device_node *of_node = dev->of_node;
- struct device_node *layers_node;
+ struct device_node *layers_node __free(device_node) =
+ of_get_child_by_name(of_node, "layers");
struct logicvc_layer *layer;
struct logicvc_layer *next;
int ret = 0;
- layers_node = of_get_child_by_name(of_node, "layers");
if (!layers_node) {
drm_err(drm_dev, "No layers node found in the description\n");
ret = -ENODEV;
@@ -611,14 +611,10 @@ int logicvc_layers_init(struct logicvc_drm *logicvc)
}
ret = logicvc_layer_init(logicvc, layer_node, index);
- if (ret) {
- of_node_put(layers_node);
+ if (ret)
goto error;
- }
}
- of_node_put(layers_node);
-
return 0;
error:
--
2.43.0
next prev parent reply other threads:[~2024-10-10 23:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-10 23:11 [PATCH 0/3] drm: logicvc: add of_node_put() and switch to a more secure approach Javier Carrasco
2024-10-10 23:11 ` [PATCH 1/3] drm: logicvc: fix missing of_node_put() in for_each_child_of_node() Javier Carrasco
2024-10-11 13:06 ` Louis Chauvet
2024-10-10 23:11 ` [PATCH 2/3] drm: logicvc: switch to for_each_child_of_node_scoped() Javier Carrasco
2024-10-11 13:01 ` Louis Chauvet
2024-10-11 13:06 ` Louis Chauvet
2024-10-11 13:06 ` Javier Carrasco
2024-10-10 23:11 ` Javier Carrasco [this message]
2024-10-11 13:01 ` [PATCH 3/3] drm: logicvc: use automatic cleanup facility for layers_node Louis Chauvet
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=20241011-logicvc_layer_of_node_put-v1-3-1ec36bdca74f@gmail.com \
--to=javier.carrasco.cruz@gmail.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=paul.kocialkowski@bootlin.com \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/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
all inboxes | Powered by JetHome®