From: Dan Carpenter <dan.carpenter@oracle.com>
To: Andrzej Hajda <a.hajda@samsung.com>
Cc: Adrien Grassein <adrien.grassein@gmail.com>,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4 1/1] drm/bridge: lt8912b: Fix issues found during static analysis
Date: Wed, 31 Mar 2021 17:39:23 +0300 [thread overview]
Message-ID: <20210331143923.GO2088@kadam> (raw)
In-Reply-To: <ba8f5a59-e428-ab21-23b9-0a7e650f532c@samsung.com>
On Wed, Mar 31, 2021 at 02:57:31PM +0200, Andrzej Hajda wrote:
> >
> > if (!of_device_is_compatible(port_node, "hdmi-connector")) {
> > dev_err(lt->dev, "%s: Failed to get hdmi port\n", __func__);
> > + of_node_put(port_node);
> > ret = -EINVAL;
> > + goto err_free_host_node;
>
> Maybe better would be to put of_node_put(port_node) after
> err_free_host_node label - of_node_put(NULL) does nothing.
>
I prefer this style for several reasons:
1) I kind of hate no-op puts
2) The port_node is not part of the wind up in the sense that we don't
leave hold the reference on the success path. It's the same with
locking, I prefer if unlock happens before the goto. Sometimes
people do an unlock as part of the unwind but this style only works
for the first label in the unwind path.
3) I like when you can copy and paste the unwind code to create the
release function, lt8912_put_dt() in this example. Normally you have
to add one more release function because most times the last failure
path is an allocation but in this case the release is just
of_node_put(lt->host_node);
But, yeah, putting the of_node_put() after the label isn't bug so
whatever...
regards,
dan carpenter
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
prev parent reply other threads:[~2021-03-31 14:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-31 11:49 [PATCH v4 0/1] Fixes 30e2ae943c26 "drm/bridge: Introduce LT8912B DSI to HDMI" Adrien Grassein
2021-03-31 11:49 ` [PATCH v4 1/1] drm/bridge: lt8912b: Fix issues found during static analysis Adrien Grassein
2021-03-31 12:14 ` Dan Carpenter
2021-03-31 12:57 ` Andrzej Hajda
2021-03-31 14:39 ` Dan Carpenter [this message]
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=20210331143923.GO2088@kadam \
--to=dan.carpenter@oracle.com \
--cc=a.hajda@samsung.com \
--cc=adrien.grassein@gmail.com \
--cc=dri-devel@lists.freedesktop.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