From: Al Viro <viro@zeniv.linux.org.uk>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Christian Brauner <brauner@kernel.org>,
linux-fsdevel@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH] chardev: Simplify usage of try_module_get()
Date: Mon, 16 Oct 2023 23:43:11 +0100 [thread overview]
Message-ID: <20231016224311.GI800259@ZenIV> (raw)
In-Reply-To: <20231013132441.1406200-2-u.kleine-koenig@pengutronix.de>
On Fri, Oct 13, 2023 at 03:24:42PM +0200, Uwe Kleine-König wrote:
> try_module_get(NULL) is true, so there is no need to check owner being
> NULL.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> fs/char_dev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/char_dev.c b/fs/char_dev.c
> index 950b6919fb87..6ba032442b39 100644
> --- a/fs/char_dev.c
> +++ b/fs/char_dev.c
> @@ -350,7 +350,7 @@ static struct kobject *cdev_get(struct cdev *p)
> struct module *owner = p->owner;
> struct kobject *kobj;
>
> - if (owner && !try_module_get(owner))
> + if (!try_module_get(owner))
> return NULL;
> kobj = kobject_get_unless_zero(&p->kobj);
> if (!kobj)
I wouldn't mind that, if that logics in try_module_get() was inlined.
It isn't...
next prev parent reply other threads:[~2023-10-16 22:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-13 13:24 [PATCH] chardev: Simplify usage of try_module_get() Uwe Kleine-König
2023-10-13 15:42 ` Christian Brauner
2023-10-16 22:43 ` Al Viro [this message]
2023-10-17 9:13 ` Uwe Kleine-König
2023-10-17 9:54 ` Al Viro
2023-12-07 9:23 ` Uwe Kleine-König
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=20231016224311.GI800259@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=brauner@kernel.org \
--cc=kernel@pengutronix.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
/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