All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Wander Lairson Costa <wander@redhat.com>
Cc: David Gow <davidgow@google.com>,
	Brendan Higgins <brendan.higgins@linux.dev>,
	Rae Moar <rmoar@google.com>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Maxime Ripard <mripard@kernel.org>,
	Matti Vaittinen <mazziesaccount@gmail.com>,
	"open list:KERNEL UNIT TESTING FRAMEWORK (KUnit)"
	<linux-kselftest@vger.kernel.org>,
	"open list:KERNEL UNIT TESTING FRAMEWORK (KUnit)"
	<kunit-dev@googlegroups.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 2/2] kunit: avoid memory leak on device register error
Date: Fri, 19 Apr 2024 15:59:46 +0200	[thread overview]
Message-ID: <2024041941-declared-footrest-9e8f@gregkh> (raw)
In-Reply-To: <CAAq0SUmMdTb5C-SCSD5WPPyj5B1iB6dD5QWuDTsXPnJktFr36g@mail.gmail.com>

On Fri, Apr 19, 2024 at 09:30:06AM -0300, Wander Lairson Costa wrote:
> As a side note, the behavior of device_register() seems
> counterintuitive and error-prone, IMO. If the function returns an
> error, it should ensure it leaks no resource and shouldn't require the
> caller to do any cleanup.

I too want a pony, but that's not the way the code works here, sorry.
It's always been like this, and has always been a problem, but last time
I looked, there was no way to really fix this.  That's why we document
it a lot to make sure people don't get the error paths wrong here.  I
know it's a pain :(

sorry,

greg k-h

  reply	other threads:[~2024-04-19 13:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-18 21:02 [PATCH v3 0/2] kunit: fix minor error path mistakes Wander Lairson Costa
2024-04-18 21:02 ` [PATCH v3 1/2] kunit: unregister the device on error Wander Lairson Costa
2024-04-19  4:58   ` David Gow
2024-04-19  5:40   ` Markus Elfring
2024-04-19  6:07     ` Greg Kroah-Hartman
2024-04-18 21:02 ` [PATCH v3 2/2] kunit: avoid memory leak on device register error Wander Lairson Costa
2024-04-19  4:58   ` David Gow
2024-04-19 12:30     ` Wander Lairson Costa
2024-04-19 13:59       ` Greg Kroah-Hartman [this message]
2024-04-19  6:15   ` Markus Elfring
2024-04-19  6:33     ` Greg Kroah-Hartman

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=2024041941-declared-footrest-9e8f@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=brendan.higgins@linux.dev \
    --cc=davidgow@google.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mazziesaccount@gmail.com \
    --cc=mripard@kernel.org \
    --cc=rmoar@google.com \
    --cc=skhan@linuxfoundation.org \
    --cc=wander@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.