Re: [v1 2/3] include: move lookup_or_create_module_kobject()/to_module* to module.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> +static inline struct module_kobject * __init lookup_or_create_module_kobject(const char *name)

Crazily unreadable line.

Either way this is not a function that should be inline in a header.
Both due to sheer size, but also due to what it does and what it pulls
in.

> +{
> +	struct module_kobject *mk;
> +	struct kobject *kobj;
> +	int err;
> +
> +	kobj = kset_find_obj(module_kset, name);
> +	if (kobj) {
> +		mk = to_module_kobject(kobj);
> +	} else {

And I know this is just moving the code, but an ealy return here
would significanty clean up the function..

> +		mk = kzalloc(sizeof(struct module_kobject), GFP_KERNEL);
> +		BUG_ON(!mk);

.. and a BUG_ON on allocation failure is a no-go.





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux