All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Barry Song <21cnbao@gmail.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	Mark Brown <broonie@linaro.org>, Takashi Iwai <tiwai@suse.de>,
	DL-SHA-WorkGroupLinux <workgroup.linux@csr.com>,
	peter.ujfalusi@ti.com, Barry Song <Baohua.Song@csr.com>
Subject: Re: [PATCH] ALSA: pcm_dmaengine: correct the error handler of dmaengine_prep_dma_cyclic
Date: Thu, 25 Dec 2014 10:45:52 +0100	[thread overview]
Message-ID: <549BDCD0.1040001@metafoo.de> (raw)
In-Reply-To: <CAGsJ_4x_mooOe4Uz6MRDtdKNCJ8RLL7jdvTr7HDbzabov_sLBA@mail.gmail.com>

On 12/25/2014 10:08 AM, Barry Song wrote:
> 2014-12-25 17:02 GMT+08:00 Lars-Peter Clausen <lars@metafoo.de>:
>> On 12/25/2014 05:41 AM, Barry Song wrote:
>>>
>>> From: Barry Song <Baohua.Song@csr.com>
>>>
>>> preparing cyclic DMA description can fail either due to DMA desc list
>>> is full(-ENOMEM), or due to the coming DMA configuration is illegal or
>>> not supported by the acting DMA hardware(other ERR codes).
>>
>>
>> According to the API definition this returns either NULL or a valid
>> descriptor, so the behavior in pcm_dmaengine is correct. Maybe your
>> particular dmaengine driver as a incorrect implementation.
>
> i think it is something wrong. an functions returns pointer should return one of
> (1) right pointer
> (2) NULL
> (3) a wrong pointer from error CODES
>
> if for 2&3, we both return NULL, it actually means we are taking
> something wrong.
>
> this should be a generic rule as from clk and other subsystems. why
> does DMA want to do something special?

I think the dmaengine API simply predates the widespread use of ERR_PTR.

And it probably makes sense to update it to use ERR_PTR to have more 
meaningful error codes. But this needs to be done in a way that makes sure 
that all providers and all consumers agree on the same semantics. E.g. first 
update all consumers to handle ERR_PTR or NULL, then update all providers to 
return a ERR_PTR instead of NULL, then update all consumers to just handle 
ERR_PTR.

- Lars

  parent reply	other threads:[~2014-12-25  9:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-25  4:41 [PATCH] ALSA: pcm_dmaengine: correct the error handler of dmaengine_prep_dma_cyclic Barry Song
2014-12-25  9:02 ` Lars-Peter Clausen
2014-12-25  9:08   ` Barry Song
2014-12-25  9:35     ` Barry Song
2014-12-25  9:45     ` Lars-Peter Clausen [this message]
2014-12-25  9:53       ` Barry Song

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=549BDCD0.1040001@metafoo.de \
    --to=lars@metafoo.de \
    --cc=21cnbao@gmail.com \
    --cc=Baohua.Song@csr.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@linaro.org \
    --cc=peter.ujfalusi@ti.com \
    --cc=tiwai@suse.de \
    --cc=workgroup.linux@csr.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.