From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751519AbcHKOPn (ORCPT ); Thu, 11 Aug 2016 10:15:43 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:34297 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750708AbcHKOPl (ORCPT ); Thu, 11 Aug 2016 10:15:41 -0400 Subject: Re: [PATCH -next] ASoC: sun4i-codec: Fix error return code in sun4i_codec_probe() To: Chen-Yu Tsai References: <1470836554-11569-1-git-send-email-weiyj.lk@gmail.com> Cc: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Maxime Ripard , Kuninori Morimoto , Emilio Lopez , Hans De Goede , ats@offog.org, fengguang.wu@intel.com, Linux-ALSA , linux-arm-kernel , linux-kernel From: Wei Yongjun Message-ID: Date: Thu, 11 Aug 2016 22:15:27 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi On 08/10/2016 10:04 PM, Chen-Yu Tsai wrote: > On Wed, Aug 10, 2016 at 9:42 PM, Wei Yongjun 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 >> --- >> 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()?