* [PATCH -next] ASoC: sun4i-codec: Fix error return code in sun4i_codec_probe()
@ 2016-08-10 13:42 Wei Yongjun
2016-08-10 14:04 ` Chen-Yu Tsai
0 siblings, 1 reply; 4+ messages in thread
From: Wei Yongjun @ 2016-08-10 13:42 UTC (permalink / raw)
To: lgirdwood, broonie, perex, tiwai, maxime.ripard, wens,
kuninori.morimoto.gx, emilio, hdegoede, ats, fengguang.wu
Cc: alsa-devel, Wei Yongjun, linux-kernel, linux-arm-kernel
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;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH -next] ASoC: sun4i-codec: Fix error return code in sun4i_codec_probe() 2016-08-10 13:42 [PATCH -next] ASoC: sun4i-codec: Fix error return code in sun4i_codec_probe() Wei Yongjun @ 2016-08-10 14:04 ` Chen-Yu Tsai 2016-08-11 14:15 ` Wei Yongjun 0 siblings, 1 reply; 4+ messages in thread From: Chen-Yu Tsai @ 2016-08-10 14:04 UTC (permalink / raw) To: Wei Yongjun Cc: Linux-ALSA, fengguang.wu, Kuninori Morimoto, Emilio Lopez, linux-kernel, Takashi Iwai, ats, Liam Girdwood, Hans De Goede, Chen-Yu Tsai, Mark Brown, Maxime Ripard, linux-arm-kernel 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] ASoC: sun4i-codec: Fix error return code in sun4i_codec_probe() 2016-08-10 14:04 ` Chen-Yu Tsai @ 2016-08-11 14:15 ` Wei Yongjun 2016-08-22 5:54 ` Maxime Ripard 0 siblings, 1 reply; 4+ messages in thread From: Wei Yongjun @ 2016-08-11 14:15 UTC (permalink / raw) To: Chen-Yu Tsai Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai, Maxime Ripard, Kuninori Morimoto, Emilio Lopez, Hans De Goede, ats, fengguang.wu, Linux-ALSA, linux-arm-kernel, linux-kernel 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()? ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] ASoC: sun4i-codec: Fix error return code in sun4i_codec_probe() 2016-08-11 14:15 ` Wei Yongjun @ 2016-08-22 5:54 ` Maxime Ripard 0 siblings, 0 replies; 4+ messages in thread From: Maxime Ripard @ 2016-08-22 5:54 UTC (permalink / raw) To: Wei Yongjun Cc: Chen-Yu Tsai, Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto, Emilio Lopez, Hans De Goede, ats, fengguang.wu, Linux-ALSA, linux-arm-kernel, linux-kernel [-- Attachment #1: Type: text/plain, Size: 1720 bytes --] 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 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-08-22 5:54 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-08-10 13:42 [PATCH -next] ASoC: sun4i-codec: Fix error return code in sun4i_codec_probe() Wei Yongjun 2016-08-10 14:04 ` Chen-Yu Tsai 2016-08-11 14:15 ` Wei Yongjun 2016-08-22 5:54 ` Maxime Ripard
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).