From: Eli Billauer <eli.billauer@gmail.com>
To: Ma Ke <make24@iscas.ac.cn>, arnd@arndb.de, gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
stable@vger.kernel.org
Subject: Re: [PATCH v4] char: xillybus: Fix error handling in xillybus_init_chrdev()
Date: Sun, 20 Jul 2025 10:05:43 +0200 [thread overview]
Message-ID: <7a86086f-5b3b-104c-f06d-4194464d84e3@outbound.gmail.com> (raw)
In-Reply-To: <20250719131758.3458238-1-make24@iscas.ac.cn>
Hello,
On 19/07/2025 15:17, Ma Ke wrote:
> Use cdev_del() instead of direct kobject_put() when cdev_add() fails.
> This aligns with standard kernel practice and maintains consistency
> within the driver's own error paths.
>
Sorry, to the extent it matters, I'm not acknowledging this.
This is merely a code styling issue, and as far as I know, there is no
"standard kernel practice" on this matter. If such standard practice
exists, the correct way is to prepare a patchset of *all* occurrences of
kobject_put() used this way, and replace them all (e.g. fs/char_dev.c,
uio/uio.c and tty/tty_io.c). Should xillybus_class be included in this
patchset, I will of course ack it, not that it would matter much.
In my opinion, using cdev_del() is incorrect, as you can't delete
something that failed to be added. Practically this causes no problem,
but as a question of style, the kobject_put() call acts as the reversal
of cdev_alloc(). This is formally more accurate, and this is the reason
I chose to do it this way.
But more than anything, I find this patch pointless, unless someone
explains why it has any use. I'm open to new insights.
Regards,
Eli
next prev parent reply other threads:[~2025-07-20 8:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-19 13:17 Ma Ke
2025-07-20 8:05 ` Eli Billauer [this message]
2025-07-20 8:32 ` Greg KH
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=7a86086f-5b3b-104c-f06d-4194464d84e3@outbound.gmail.com \
--to=eli.billauer@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=make24@iscas.ac.cn \
--cc=stable@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
all inboxes | Powered by JetHome®