From: Dan Carpenter <dan.carpenter@oracle.com>
To: Eric Anholt <eric@anholt.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
linux-rpi-kernel@lists.infradead.org,
Stefan Wahren <stefan.wahren@i2se.com>
Subject: Re: [PATCH] staging: bcm2835-camera: Replace open-coded idr with a struct idr.
Date: Tue, 15 May 2018 15:04:46 +0300 [thread overview]
Message-ID: <20180515120446.74vrnucehduhi554@mwanda> (raw)
In-Reply-To: <20180510233107.1684-1-eric@anholt.net>
On Thu, May 10, 2018 at 04:31:07PM -0700, Eric Anholt wrote:
> @@ -258,32 +181,40 @@ get_msg_context(struct vchiq_mmal_instance *instance)
> if (!msg_context)
> return ERR_PTR(-ENOMEM);
>
> - msg_context->instance = instance;
> - msg_context->handle =
> - mmal_context_map_create_handle(&instance->context_map,
> - msg_context,
> - GFP_KERNEL);
> + /* Create an ID that will be passed along with our message so
> + * that when we service the VCHI reply, we can look up what
> + * message is being replied to.
> + */
> + spin_lock(&instance->context_map_lock);
> + handle = idr_alloc(&instance->context_map, msg_context,
> + 0, 0, GFP_KERNEL);
> + spin_unlock(&instance->context_map_lock);
>
> - if (!msg_context->handle) {
> + if (msg_context->handle < 0) {
This should probably be testing:
if (handle < 0) {
> kfree(msg_context);
> - return ERR_PTR(-ENOMEM);
> + return ERR_PTR(handle);
> }
>
> + msg_context->instance = instance;
> + msg_context->handle = handle;
> +
> return msg_context;
> }
>
next prev parent reply other threads:[~2018-05-15 12:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-10 23:31 Eric Anholt
2018-05-10 23:40 ` Stefan Wahren
2018-05-11 0:41 ` Eric Anholt
2018-05-15 12:04 ` Dan Carpenter [this message]
2018-05-15 13:46 ` Eric Anholt
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=20180515120446.74vrnucehduhi554@mwanda \
--to=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=eric@anholt.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=stefan.wahren@i2se.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®