linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] chardev: Simplify usage of try_module_get()
@ 2023-10-13 13:24 Uwe Kleine-König
  2023-10-13 15:42 ` Christian Brauner
  2023-10-16 22:43 ` Al Viro
  0 siblings, 2 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2023-10-13 13:24 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner; +Cc: linux-fsdevel, kernel

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)
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-12-07  9:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2023-10-17  9:54     ` Al Viro
2023-12-07  9:23       ` Uwe Kleine-König

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).