Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1459695 > unrolled thread
| Started by | Chen-Yu Tsai <wens@csie.org> |
|---|---|
| First post | 2016-08-10 21:40 +0200 |
| Last post | 2016-08-22 08:40 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH -next] ASoC: sun4i-codec: Fix error return code in sun4i_codec_probe() Chen-Yu Tsai <wens@csie.org> - 2016-08-10 21:40 +0200
Re: [PATCH -next] ASoC: sun4i-codec: Fix error return code in sun4i_codec_probe() Wei Yongjun <weiyj.lk@gmail.com> - 2016-08-11 16:20 +0200
Re: [PATCH -next] ASoC: sun4i-codec: Fix error return code in sun4i_codec_probe() Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-08-22 08:40 +0200
| From | Chen-Yu Tsai <wens@csie.org> |
|---|---|
| Date | 2016-08-10 21:40 +0200 |
| Subject | Re: [PATCH -next] ASoC: sun4i-codec: Fix error return code in sun4i_codec_probe() |
| Message-ID | <s4Hw7-YV-53@gated-at.bofh.it> |
On Wed, Aug 10, 2016 at 9:42 PM, Wei Yongjun <weiyj.lk@gmail.com> wrote:
> Fix to return error code -ENOMEM instead of 0 when create card
> failed, as done elsewhere in this function.
>
> Fixes: 45fb6b6f2aa3 ("ASoC: sunxi: add support for the on-chip
> codec on early Allwinner SoCs")
> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
> ---
> sound/soc/sunxi/sun4i-codec.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
> index 0e19c50..e741659 100644
> --- a/sound/soc/sunxi/sun4i-codec.c
> +++ b/sound/soc/sunxi/sun4i-codec.c
> @@ -846,6 +846,7 @@ static int sun4i_codec_probe(struct platform_device *pdev)
> card = sun4i_codec_create_card(&pdev->dev);
> if (!card) {
> dev_err(&pdev->dev, "Failed to create our card\n");
> + ret = -ENOMEM;
> goto err_unregister_codec;
> }
>
This works, though it might be better to fix the create_card function and
any custom functions called in there to pass back a proper error value.
Regards
ChenYu
[toc] | [next] | [standalone]
| From | Wei Yongjun <weiyj.lk@gmail.com> |
|---|---|
| Date | 2016-08-11 16:20 +0200 |
| Subject | Re: [PATCH -next] ASoC: sun4i-codec: Fix error return code in sun4i_codec_probe() |
| Message-ID | <s4YZX-4Uf-7@gated-at.bofh.it> |
| In reply to | #1459695 |
Hi
On 08/10/2016 10:04 PM, Chen-Yu Tsai wrote:
> On Wed, Aug 10, 2016 at 9:42 PM, Wei Yongjun <weiyj.lk@gmail.com> wrote:
>> Fix to return error code -ENOMEM instead of 0 when create card
>> failed, as done elsewhere in this function.
>>
>> Fixes: 45fb6b6f2aa3 ("ASoC: sunxi: add support for the on-chip
>> codec on early Allwinner SoCs")
>> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
>> ---
>> sound/soc/sunxi/sun4i-codec.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
>> index 0e19c50..e741659 100644
>> --- a/sound/soc/sunxi/sun4i-codec.c
>> +++ b/sound/soc/sunxi/sun4i-codec.c
>> @@ -846,6 +846,7 @@ static int sun4i_codec_probe(struct platform_device *pdev)
>> card = sun4i_codec_create_card(&pdev->dev);
>> if (!card) {
>> dev_err(&pdev->dev, "Failed to create our card\n");
>> + ret = -ENOMEM;
>> goto err_unregister_codec;
>> }
>>
> This works, though it might be better to fix the create_card function and
> any custom functions called in there to pass back a proper error value.
>
Since sun4i_codec_create_card() can only failed when kmalloc() return NULL, so
still need to change sun4i_codec_create_card()?
[toc] | [prev] | [next] | [standalone]
| From | Maxime Ripard <maxime.ripard@free-electrons.com> |
|---|---|
| Date | 2016-08-22 08:40 +0200 |
| Subject | Re: [PATCH -next] ASoC: sun4i-codec: Fix error return code in sun4i_codec_probe() |
| Message-ID | <s8R3P-2Dz-1@gated-at.bofh.it> |
| In reply to | #1460562 |
[Multipart message — attachments visible in raw view] — view raw
Hi,
On Thu, Aug 11, 2016 at 10:15:27PM +0800, Wei Yongjun wrote:
> Hi
>
> On 08/10/2016 10:04 PM, Chen-Yu Tsai wrote:
> > On Wed, Aug 10, 2016 at 9:42 PM, Wei Yongjun <weiyj.lk@gmail.com> wrote:
> >> Fix to return error code -ENOMEM instead of 0 when create card
> >> failed, as done elsewhere in this function.
> >>
> >> Fixes: 45fb6b6f2aa3 ("ASoC: sunxi: add support for the on-chip
> >> codec on early Allwinner SoCs")
> >> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
> >> ---
> >> sound/soc/sunxi/sun4i-codec.c | 1 +
> >> 1 file changed, 1 insertion(+)
> >>
> >> diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
> >> index 0e19c50..e741659 100644
> >> --- a/sound/soc/sunxi/sun4i-codec.c
> >> +++ b/sound/soc/sunxi/sun4i-codec.c
> >> @@ -846,6 +846,7 @@ static int sun4i_codec_probe(struct platform_device *pdev)
> >> card = sun4i_codec_create_card(&pdev->dev);
> >> if (!card) {
> >> dev_err(&pdev->dev, "Failed to create our card\n");
> >> + ret = -ENOMEM;
> >> goto err_unregister_codec;
> >> }
> >>
> > This works, though it might be better to fix the create_card function and
> > any custom functions called in there to pass back a proper error value.
> >
> Since sun4i_codec_create_card() can only failed when kmalloc() return NULL, so
> still need to change sun4i_codec_create_card()?
Yes, please do. It's better to return whatever the function was
returning. That was, if we add a new error code, we don't have to
rework the code over and over again.
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web