From: Dan Williams <dan.j.williams@intel.com>
To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org,
linux-kernel@vger.kernel.org, haavard.skinnemoen@atmel.com
Subject: Re: [PATCH 1/2] dmaengine: TXx9 Soc DMA Controller driver
Date: Mon, 16 Mar 2009 21:52:10 -0700 [thread overview]
Message-ID: <e9c3a7c20903162152w6b73b4b8hba8004e7b349c447@mail.gmail.com> (raw)
In-Reply-To: <20090317.112019.147212126.nemoto@toshiba-tops.co.jp>
On Mon, Mar 16, 2009 at 7:20 PM, Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
> On Mon, 16 Mar 2009 14:50:46 -0700, Dan Williams <dan.j.williams@intel.com> wrote:
>> > And above "continue" looks buggy anyway. Keeping incomplete channels
>> > in device->channels list looks very dangerous...
>>
>> Yes it does. Here is the proposed fix:
>> ----->
>> dmaengine: fail device registration if channel registration fails
>>
>> From: Dan Williams <dan.j.williams@intel.com>
>>
>> Atsushi points out:
>> "If alloc_percpu or kzalloc failed, chan_id does not match with its
>> position in device->channels list.
>>
>> And above "continue" looks buggy anyway. Keeping incomplete channels
>> in device->channels list looks very dangerous..."
>>
>> Reported-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
>> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
>
> Thanks, but it seems a hole sill exists. If alloc_percpu or kzalloc
> for the first channel failed, when idr_ref will be freed ?
>
True, we need a check like the following:
/* if we never registered a channel just release the idr */
if (atomic_read(idr_ref) == 0) {
mutex_lock(&dma_list_mutex);
idr_remove(&dma_idr, device->dev_id);
mutex_unlock(&dma_list_mutex);
kfree(idr_ref);
return rc;
}
> Hmm.. why idr_ref is dynamically allocated? Just putting it in
> dma_device makes thing more simple, no?
>
The sysfs device has a longer lifetime than dma_device. See commit
41d5e59c [1].
--
Dan
[1] http://git.kernel.org/?p=linux/kernel/git/djbw/async_tx.git;a=commitdiff;h=41d5e59c
> ---
> Atsushi Nemoto
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
next prev parent reply other threads:[~2009-03-17 4:52 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-13 15:28 Atsushi Nemoto
2009-02-26 1:45 ` Dan Williams
2009-02-26 15:24 ` Atsushi Nemoto
2009-03-12 16:19 ` Atsushi Nemoto
2009-03-13 14:16 ` Atsushi Nemoto
2009-03-16 21:50 ` Dan Williams
2009-03-17 2:20 ` Atsushi Nemoto
2009-03-17 4:52 ` Dan Williams [this message]
2009-03-17 16:09 ` Atsushi Nemoto
2009-03-17 17:02 ` Dan Williams
2009-03-18 0:49 ` Atsushi Nemoto
2009-03-18 1:23 ` Dan Williams
2009-03-18 2:01 ` Atsushi Nemoto
2009-03-18 17:26 ` Dan Williams
2009-03-21 12:29 ` Atsushi Nemoto
2009-03-26 14:12 ` Atsushi Nemoto
2009-03-31 19:34 ` Dan Williams
2009-04-01 16:20 ` Atsushi Nemoto
2009-03-16 21:20 ` Dan Williams
2009-03-17 1:52 ` Atsushi Nemoto
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=e9c3a7c20903162152w6b73b4b8hba8004e7b349c447@mail.gmail.com \
--to=dan.j.williams@intel.com \
--cc=anemo@mba.ocn.ne.jp \
--cc=haavard.skinnemoen@atmel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.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
all inboxes | Powered by JetHome®