From: Neil Armstrong <narmstrong@baylibre.com>
To: Dan Carpenter <dan.carpenter@oracle.com>, Phong LE <ple@baylibre.com>
Cc: Andrzej Hajda <a.hajda@samsung.com>,
Robert Foss <robert.foss@linaro.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
dri-devel@lists.freedesktop.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 2/2] drm: bridge: it66121: fix a resource leak in probe
Date: Mon, 17 May 2021 10:43:21 +0200 [thread overview]
Message-ID: <873d476b-d8b2-8757-47ba-4588231ceac3@baylibre.com> (raw)
In-Reply-To: <YJ+ZgXTFa6voZuJG@mwanda>
On 15/05/2021 11:50, Dan Carpenter wrote:
> In the original code if the "ctx = devm_kzalloc()" allocation failed
> then we should have called of_node_put(ep); before returning. It's
> actually a bit easier to do the allocation first before assigning
> ep = of_graph_get_endpoint_by_regs().
>
> Fixes: 988156dc2fc9 ("drm: bridge: add it66121 driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/gpu/drm/bridge/ite-it66121.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c
> index 6980c9801d0d..7149ed40af83 100644
> --- a/drivers/gpu/drm/bridge/ite-it66121.c
> +++ b/drivers/gpu/drm/bridge/ite-it66121.c
> @@ -898,14 +898,14 @@ static int it66121_probe(struct i2c_client *client,
> return -ENXIO;
> }
>
> - ep = of_graph_get_endpoint_by_regs(dev->of_node, 0, 0);
> - if (!ep)
> - return -EINVAL;
> -
> ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
> if (!ctx)
> return -ENOMEM;
>
> + ep = of_graph_get_endpoint_by_regs(dev->of_node, 0, 0);
> + if (!ep)
> + return -EINVAL;
> +
> ctx->dev = dev;
> ctx->client = client;
>
>
Thanks !
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Applying to drm-misc-fixes
next prev parent reply other threads:[~2021-05-17 8:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-15 9:50 [PATCH 1/2] drm: bridge: it66121: fix an error code in it66121_probe() Dan Carpenter
2021-05-15 9:50 ` [PATCH 2/2] drm: bridge: it66121: fix a resource leak in probe Dan Carpenter
2021-05-17 8:43 ` Neil Armstrong [this message]
2021-05-17 8:42 ` [PATCH 1/2] drm: bridge: it66121: fix an error code in it66121_probe() Neil Armstrong
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=873d476b-d8b2-8757-47ba-4588231ceac3@baylibre.com \
--to=narmstrong@baylibre.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=a.hajda@samsung.com \
--cc=airlied@linux.ie \
--cc=dan.carpenter@oracle.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=kernel-janitors@vger.kernel.org \
--cc=ple@baylibre.com \
--cc=robert.foss@linaro.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