From: Michal Schmidt <mschmidt-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
ddutile-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
"Haralanov,
Mitko" <mitko.haralanov-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH] IB/hfi: Properly set permissions for user device files
Date: Thu, 17 Sep 2015 18:18:15 +0200 [thread overview]
Message-ID: <55FAE7C7.3070003@redhat.com> (raw)
In-Reply-To: <1442439695-14275-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
On 09/16/2015 11:41 PM, ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-09-17 16:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-16 21:41 [PATCH] IB/hfi: Properly set permissions for user device files ira.weiny-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1442439695-14275-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-09-17 13:33 ` Marciniszyn, Mike
2015-09-17 15:48 ` Don Dutile
2015-09-17 16:18 ` Michal Schmidt [this message]
[not found] ` <55FAE7C7.3070003-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-09-17 16:23 ` Jason Gunthorpe
[not found] ` <20150917162355.GA8736-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-09-17 17:15 ` Weiny, Ira
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55FAE7C7.3070003@redhat.com \
--to=mschmidt-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=ddutile-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=mitko.haralanov-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox