linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: dinghao.liu@zju.edu.cn
To: "Markus Elfring" <Markus.Elfring@web.de>
Cc: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Ben Skeggs" <bskeggs@redhat.com>,
	"David Airlie" <airlied@linux.ie>, "Kangjie Lu" <kjlu@umn.edu>
Subject: Re: Re: drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
Date: Sun, 31 May 2020 17:15:27 +0800 (GMT+08:00)	[thread overview]
Message-ID: <1c5b64dc.db888.1726a03b710.Coremail.dinghao.liu@zju.edu.cn> (raw)
In-Reply-To: <5a073b2b-5102-adec-84dd-b62dc48c7451@web.de>

> > I just found that clk is referenced by pclk in this function. When clk is freed,
> > pclk will be allocated in gm20b_clk_new_speedo0(). Thus we should not release clk
> > in this function and there is no bug here.
> 
> Can there be a need to release a clock object after a failed gk20a_clk_ctor() call?
> 

I think this mainly depends on pclk pointer. It seems that the caller of 
gm20b_clk_new() always expects pclk to be allocated unless it returns -ENOMEM,
which means kzalloc() failed. If gk20a_clk_ctor() never returns such an error 
code, we may need not to release this clock object.

Regards,
Dinghao

  reply	other threads:[~2020-05-31  9:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-31  8:03 [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new() Markus Elfring
2020-05-31  8:23 ` dinghao.liu
2020-05-31  8:38   ` Markus Elfring
2020-05-31  8:52     ` dinghao.liu
2020-05-31  9:00       ` Markus Elfring
2020-05-31  9:15         ` dinghao.liu [this message]
2020-05-31  9:51           ` Markus Elfring
2020-05-31 10:42             ` dinghao.liu
2020-05-31 12:14               ` drm/nouveau/clk/gm20b: Fix memory leaks after failed gk20a_clk_ctor() calls Markus Elfring
2020-06-02 10:29   ` Re: [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new() Dan Carpenter
2020-06-02 11:10     ` Markus Elfring
2020-06-02 15:39       ` Dan Carpenter
2020-06-03  2:21         ` dinghao.liu
2020-06-03  5:04           ` drm/nouveau/clk/gm20b: Understanding challenges around gm20b_clk_new() 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=1c5b64dc.db888.1726a03b710.Coremail.dinghao.liu@zju.edu.cn \
    --to=dinghao.liu@zju.edu.cn \
    --cc=Markus.Elfring@web.de \
    --cc=airlied@linux.ie \
    --cc=bskeggs@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nouveau@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;
as well as URLs for NNTP newsgroup(s).