linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org,
	Christian Brauner <brauner@kernel.org>,
	kernel@pengutronix.de
Subject: Re: [PATCH] chardev: Simplify usage of try_module_get()
Date: Tue, 17 Oct 2023 11:13:53 +0200	[thread overview]
Message-ID: <20231017091353.6fhpmrcx66jj2jls@pengutronix.de> (raw)
In-Reply-To: <20231016224311.GI800259@ZenIV>

[-- Attachment #1: Type: text/plain, Size: 1457 bytes --]

On Mon, Oct 16, 2023 at 11:43:11PM +0100, Al Viro wrote:
> 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...

I don't understand what you intend to say here. What is "that"? Are you
talking about

	owner && !try_module_get(owner)

vs

	!try_module_get(owner)

or the following line with kobject_get_unless_zero? Do you doubt the
validity of my patch, or is it about something try_module_get()
could/should do more than it currently does?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2023-10-17  9:13 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
2023-10-17  9:13   ` Uwe Kleine-König [this message]
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=20231017091353.6fhpmrcx66jj2jls@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=brauner@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).