Skip to content

Commit e311ba2

Browse files
Uwe Kleine-Königbrauner
authored andcommitted
chardev: Simplify usage of try_module_get()
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> Link: https://lore.kernel.org/r/20231013132441.1406200-2-u.kleine-koenig@pengutronix.de Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 2bc5e5e commit e311ba2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/char_dev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ static struct kobject *cdev_get(struct cdev *p)
350350
struct module *owner = p->owner;
351351
struct kobject *kobj;
352352

353-
if (owner && !try_module_get(owner))
353+
if (!try_module_get(owner))
354354
return NULL;
355355
kobj = kobject_get_unless_zero(&p->kobj);
356356
if (!kobj)

0 commit comments

Comments
 (0)