From: Machiry Aravind Kumar <makrvcs@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Incorrect usage of kobject_init_and_add?
Date: Wed, 9 Jan 2019 15:14:10 -0800 [thread overview]
Message-ID: <CAAwk1nJOxG-2tCfTCUSgVMP2SXeNnWheT_4K6+WUMCxYVph7nA@mail.gmail.com> (raw)
Hi all,
I see some discrepancy in how the function: kobject_init_and_add is
used in various places of the kernel.
According to the docs, when kobject_init_and_add fails, the caller is
supposed to call kobject_put on the corresponding kobj.
We found several instances where this is indeed true:
https://elixir.bootlin.com/linux/latest/source/drivers/block/pktcdvd.c#L131
However, there are again several places where this is not the case.
For instance: https://github.com/torvalds/linux/blob/master/kernel/sched/cpufreq_schedutil.c#L754
Why is this discrepancy? Should these be fixed to add kobject_put in
their error path?
-Best,
Aravind
reply other threads:[~2019-01-09 23:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=CAAwk1nJOxG-2tCfTCUSgVMP2SXeNnWheT_4K6+WUMCxYVph7nA@mail.gmail.com \
--to=makrvcs@gmail.com \
--cc=linux-kernel@vger.kernel.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).