From: Sebastian Ene <sebastianene@google.com>
To: Vincent Donnefort <vdonnefort@google.com>
Cc: Marc Zyngier <maz@kernel.org>,
akpm@linux-foundation.org, alexghiti@rivosinc.com,
ankita@nvidia.com, ardb@kernel.org, catalin.marinas@arm.com,
christophe.leroy@csgroup.eu, james.morse@arm.com,
mark.rutland@arm.com, oliver.upton@linux.dev, rananta@google.com,
ryan.roberts@arm.com, shahuang@redhat.com,
suzuki.poulose@arm.com, will@kernel.org, yuzenghui@huawei.com,
kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, kernel-team@android.com
Subject: Re: [PATCH v9 4/5] KVM: arm64: Register ptdump with debugfs on guest creation
Date: Mon, 2 Sep 2024 13:45:56 +0000 [thread overview]
Message-ID: <ZtXBlN6nBsEUhQ4P@google.com> (raw)
In-Reply-To: <ZtWdyKtw8EGYlJz5@google.com>
On Mon, Sep 02, 2024 at 12:13:12PM +0100, Vincent Donnefort wrote:
> [...]
>
> > > > +static int kvm_ptdump_guest_open(struct inode *m, struct file *file)
> > > > +{
> > > > + struct kvm *kvm = m->i_private;
> > > > + struct kvm_ptdump_guest_state *st;
> > > > + int ret;
> > > > +
> > > > + if (!kvm_get_kvm_safe(kvm))
> > > > + return -ENOENT;
> > > > +
> > > > + st = kvm_ptdump_parser_create(kvm);
> > > > + if (IS_ERR(st)) {
> > > > + ret = PTR_ERR(st);
> > > > + goto free_with_kvm_ref;
> > > > + }
> > > > +
> > > > + ret = single_open(file, kvm_ptdump_guest_show, st);
> > > > + if (!ret)
> > > > + return 0;
> > > > +
> > > > + kfree(st);
> > > > +free_with_kvm_ref:
> > >
> > > nit: I believe kfree understands IS_ERR() so you could have a simple "err:"
> > > label covering all the error path.
> >
> > I couldn't find such handling in kfree(). Could you point be to it?
>
> My aplogies, I was confused by the DEFINE_FREE(kfree ...) for __free(). kfree()
> only checks for null ptr.
>
> Although, I wonder if the naming "free_with_kvm_ref" isn't an artifact from
> previous code? Nothing is freeed here. So perhaps err_with_kvm_ref? which could
> be shorten as this is the only label?
>
> [...]
Yes, I guess that works better. Thanks for checking,
Seb
next prev parent reply other threads:[~2024-09-02 13:47 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-27 8:45 [PATCH v9 0/5] arm64: ptdump: View the second stage page-tables Sebastian Ene
2024-08-27 8:45 ` [PATCH v9 1/5] KVM: arm64: Move pagetable definitions to common header Sebastian Ene
2024-08-27 8:45 ` [PATCH v9 2/5] arm64: ptdump: Expose the attribute parsing functionality Sebastian Ene
2024-08-30 12:28 ` Marc Zyngier
2024-09-02 5:36 ` Sebastian Ene
2024-08-27 8:45 ` [PATCH v9 3/5] arm64: ptdump: Use the ptdump description from a local context Sebastian Ene
2024-08-27 8:45 ` [PATCH v9 4/5] KVM: arm64: Register ptdump with debugfs on guest creation Sebastian Ene
2024-08-30 10:24 ` Vincent Donnefort
2024-08-30 14:11 ` Marc Zyngier
2024-09-02 5:27 ` Sebastian Ene
2024-09-02 11:13 ` Vincent Donnefort
2024-09-02 13:45 ` Sebastian Ene [this message]
2024-09-02 5:31 ` Sebastian Ene
2024-08-27 8:45 ` [PATCH v9 5/5] KVM: arm64: Introduce the PTDUMP_STAGE2_DEBUGFS config Sebastian Ene
2024-08-30 10:26 ` Vincent Donnefort
2024-08-30 14:44 ` [PATCH v9 0/5] arm64: ptdump: View the second stage page-tables Marc Zyngier
2024-08-30 15:00 ` Marc Zyngier
2024-09-02 6:11 ` Sebastian Ene
2024-09-02 7:08 ` Sebastian Ene
2024-09-02 8:22 ` Marc Zyngier
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=ZtXBlN6nBsEUhQ4P@google.com \
--to=sebastianene@google.com \
--cc=akpm@linux-foundation.org \
--cc=alexghiti@rivosinc.com \
--cc=ankita@nvidia.com \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=christophe.leroy@csgroup.eu \
--cc=james.morse@arm.com \
--cc=kernel-team@android.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=oliver.upton@linux.dev \
--cc=rananta@google.com \
--cc=ryan.roberts@arm.com \
--cc=shahuang@redhat.com \
--cc=suzuki.poulose@arm.com \
--cc=vdonnefort@google.com \
--cc=will@kernel.org \
--cc=yuzenghui@huawei.com \
/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).