On 09/16/2015 11:41 PM, [email protected] wrote:
> @@ -125,7 +151,20 @@ int __init dev_init(void)
> ret = PTR_ERR(class);
> pr_err("Could not create device class (err %d)\n", -ret);
> unregister_chrdev_region(hfi1_dev, HFI1_NMINORS);
> + goto done;
> }
> + class->devnode = hfi1_devnode;
> +
> + user_class = class_create(THIS_MODULE, class_name_user());
> + if (IS_ERR(user_class)) {
> + ret = PTR_ERR(user_class);
> + pr_err("Could not create device class for user accisble files
> (err %d)\n",
^^^^^^^^
Typo in error message.
> + -ret);
> + class_destroy(class);
> + class = NULL;
> + unregister_chrdev_region(hfi1_dev, HFI1_NMINORS);
Missing "goto done"? Otherwise this:
> + }
> + user_class->devnode = hfi1_user_devnode;
... will explode.
>
> done:
> return ret;
> @@ -138,5 +177,10 @@ void dev_cleanup(void)
> class = NULL;
> }
>
> + if (user_class) {
> + class_destroy(user_class);
> + user_class = NULL;
> + }
> +
It's actually harmless to call class_destroy(NULL). No need to check.
Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html