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>
This commit is contained in:
Uwe Kleine-König 2023-10-13 15:24:42 +02:00 committed by Christian Brauner
parent 2bc5e5e816
commit e311ba29a5
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2

View File

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