From: Greg KH <gregkh@linuxfoundation.org>
To: Even Xu <even.xu@intel.com>
Cc: jikos@kernel.org, benjamin.tissoires@redhat.com,
srinivas.pandruvada@linux.intel.com, arnd@arndb.de,
andriy.shevchenko@intel.com, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 7/7] misc: intel-ish-client: add intel ishtp clients driver
Date: Wed, 4 Jan 2017 14:09:03 +0100 [thread overview]
Message-ID: <20170104130903.GA8832@kroah.com> (raw)
In-Reply-To: <1482456149-4841-7-git-send-email-even.xu@intel.com>
On Fri, Dec 23, 2016 at 09:22:29AM +0800, Even Xu wrote:
> +/**
> + * ishtp_cl_probe() - ISHTP client driver probe
> + * @cl_device: ISHTP client device instance
> + *
> + * This function gets called on device create on ISHTP bus
> + *
> + * Return: 0 on success, non zero on error
> + */
> +static int ishtp_cl_probe(struct ishtp_cl_device *cl_device)
> +{
> + struct ishtp_cl_miscdev *ishtp_cl_misc;
> + int ret;
> +
> + if (!cl_device)
> + return -ENODEV;
> +
> + ishtp_cl_misc = kzalloc(sizeof(struct ishtp_cl_miscdev),
> + GFP_KERNEL);
> + if (!ishtp_cl_misc)
> + return -ENOMEM;
> +
> + if (uuid_le_cmp(ishtp_smhi_guid,
> + cl_device->fw_client->props.protocol_name) == 0) {
> + ishtp_cl_misc->cl_miscdev.name = "ish-smhi";
> + } else if (uuid_le_cmp(ishtp_trace_guid,
> + cl_device->fw_client->props.protocol_name) == 0) {
> + ishtp_cl_misc->cl_miscdev.name = "ish-trace";
> + } else if (uuid_le_cmp(ishtp_traceconfig_guid,
> + cl_device->fw_client->props.protocol_name) == 0) {
> + ishtp_cl_misc->cl_miscdev.name = "ish-tracec";
> + } else if (uuid_le_cmp(ishtp_loader_guid,
> + cl_device->fw_client->props.protocol_name) == 0) {
> + ishtp_cl_misc->cl_miscdev.name = "ish-loader";
> + } else {
> + dev_err(&cl_device->dev, "Not supported client\n");
> + ret = -ENODEV;
> + goto release_mem;
> + }
> +
> + ishtp_cl_misc->cl_miscdev.parent = &cl_device->dev;
> + ishtp_cl_misc->cl_miscdev.fops = &ishtp_cl_fops;
> + ishtp_cl_misc->cl_miscdev.minor = MISC_DYNAMIC_MINOR,
> +
> + ret = misc_register(&ishtp_cl_misc->cl_miscdev);
> + if (ret) {
> + dev_err(&cl_device->dev, "misc device register failed\n");
> + goto release_mem;
> + }
Now your userspace device node is created and can be opened up and
accessed. But:
> +
> + ishtp_cl_misc->cl_device = cl_device;
> +
> + init_waitqueue_head(&ishtp_cl_misc->read_wait);
> +
> + ishtp_set_drvdata(cl_device, ishtp_cl_misc);
> +
> + ishtp_get_device(cl_device);
> +
> + mutex_init(&ishtp_cl_misc->cl_mutex);
> +
> + INIT_WORK(&ishtp_cl_misc->reset_work, ishtp_cl_reset_handler);
> +
> + /* Register event callback */
> + ishtp_register_event_cb(cl_device, ishtp_cl_event_cb);
You were not done setting up the device. What nasty races just
happened?
And the above functions can never fail? Why are you grabbing a refernce
to the cl_device yet doing nothing with it? That feels really broken
and wrong.
thanks,
greg k-h
next prev parent reply other threads:[~2017-01-04 13:09 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-23 1:22 [PATCH 1/7] hid: intel-ish-hid: ishtp: add helper function for driver data get/set Even Xu
2016-12-23 1:22 ` [PATCH 2/7] hid: intel-ish-hid: use helper function for private driver data set/get Even Xu
2016-12-23 1:22 ` [PATCH 3/7] hid: intel-ish-hid: ishtp: add helper functions for client buffer operation Even Xu
2016-12-23 1:22 ` [PATCH 4/7] hid: intel-ish-hid: use helper function to access client buffer Even Xu
2016-12-23 1:22 ` [PATCH 5/7] hid: intel-ish-hid: ishtp: add helper function for client search Even Xu
2016-12-23 1:22 ` [PATCH 6/7] hid: intel-ish-hid: use helper function to search client id Even Xu
2016-12-23 1:22 ` [PATCH 7/7] misc: intel-ish-client: add intel ishtp clients driver Even Xu
2017-01-03 9:54 ` Jiri Kosina
2017-01-04 6:55 ` Xu, Even
2017-01-04 9:36 ` Jiri Kosina
2017-01-04 12:59 ` gregkh
2017-01-04 13:03 ` Greg KH
2017-01-04 17:11 ` Srinivas Pandruvada
2017-01-04 17:18 ` Greg KH
2017-01-04 18:41 ` Srinivas Pandruvada
2017-01-04 19:40 ` Greg KH
2017-01-05 5:38 ` Xu, Even
2017-01-04 13:09 ` Greg KH [this message]
2017-01-04 13:13 ` Greg KH
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=20170104130903.GA8832@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=andriy.shevchenko@intel.com \
--cc=arnd@arndb.de \
--cc=benjamin.tissoires@redhat.com \
--cc=even.xu@intel.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=srinivas.pandruvada@linux.intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.