From patchwork Thu Dec 12 02:13:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13904602 Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11011057.outbound.protection.outlook.com [52.101.125.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E556C13AA20 for ; Thu, 12 Dec 2024 02:13:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.125.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733969599; cv=fail; b=golXxE4eQ5FtPeD34RYths2JxMyLKCyNumZ4bSG+ULSrYf4DweTV9fCBsnu1XiK5lIsKbHx+Mb4FHBqN/EG1vS5yWEawwHj5I4lNUUt45DJYT0lf+Vv2jBoorHDzkpOKm1Eo8XWosHTTP4USu6+x5VyC1PSxC1Yw25F9zS4Wsbg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733969599; c=relaxed/simple; bh=tc7A/e4N4nke3rLDorXdXSEAH2jwSbNWOWOuQtq6iBk=; h=Message-ID:From:Subject:To:Cc:Content-Type:Date:MIME-Version; b=B5u953HA1rEN5MVF+TppGiVx6N9aM3qRNRIZpy/cT+WMC+7Coz3iQPhItpGi6FYzj6nRayXDlIxvcbtfLuqPpvN34IZgB1VRTTKDE1mg9I4mVoXZkP7giut25Nk28pljhRNzCj2KydVjSUXb1lfZtYMw0EYy0SOhIXQKRKzNbvA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b=eMh2roUI; arc=fail smtp.client-ip=52.101.125.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b="eMh2roUI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BPt1+uPTs9LtesKnDNSSkzPkRybbubEX5YAtMi1t9XMg8z8a2mFuXUXlh22+PiSUkS7kesKb+GQe0aN8DZqNIzhiE13hvr3ecO/mjmaVhcSom22/YeNoCLmHiEHXLZvsGo4Vqf1aSuQ94yQtu4PwwO4Bwn/C7fnkG6rwBGgSCdZ2B4g5bBjeh/qfiopzHZpCLaLzWrFxoEUBEKmeuKWexJM/elIUrYhQTtj8bPQzXES+InjiiSW9lteRkZLNCUy80ZpmotcuFffrfy9Ix4XJdCnwbQFeYyXU4ohXq8cry5CVBwsL4UcHjuLjl8PaRURUDJOUhYMlM45b0bkXFfR5/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dXYlIuC+1TOe1jxbKpcv4Un3BjhDL6hgg+5WP8TIfvk=; b=e2x774HS/5wRsv2yz4o75OfMB2jX2gDcblcpJBJclHwhDbfX56ZldUUrgLpt6DOenEWXctGQsIbol3ursu31ZSvwJEqx2ylKiP6QL21puuGtfqI32FT/aH049ZXtZNPwKKMqnOXYCf09HCbYW1qXoyy/59lqeNICJMX3HWN+yAHsw17AVbKIoC1YUaiPPf95Fu43BAk26AqguT21VHPN1d6A640iS5DtwK9TmUNUl+5I6RG8FP+zeDunInLpZYLf6KY6Iu+1BA5DUFpy+CFic+kW+LdnGkVZFWhXk68AY83d/MYTUxZus0ujK0YqIXNqr775iA2BH7xJKOVLMv7zeQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dXYlIuC+1TOe1jxbKpcv4Un3BjhDL6hgg+5WP8TIfvk=; b=eMh2roUI8ML2VAcZhB+6bbcg499umJ4fi3AppYwrFYyATEz90Q5DWa+OfeiMnx9wynbUitJiLWmiQS6Bbq9wIk/yUqFxKvALjn2iWQ9nFVat3qbRpxJCKIWvCshy5RGzBGQob8hfkbvbG+5/fHgLA5+hG04DiL2E1Gd/H5Rlj4U= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by OSZPR01MB7986.jpnprd01.prod.outlook.com (2603:1096:604:1ba::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.15; Thu, 12 Dec 2024 02:13:13 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%4]) with mapi id 15.20.8251.008; Thu, 12 Dec 2024 02:13:13 +0000 Message-ID: <87wmg5tzra.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH] ASoC: soc-core: tidyup ret handling for card->disable_route_checks User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 To: Mark Brown Cc: linux-sound@vger.kernel.org, Pierre-Louis Bossart , Cezary Rojewski Date: Thu, 12 Dec 2024 02:13:13 +0000 X-ClientProxiedBy: TYCP286CA0098.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:2b4::19) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OSZPR01MB7986:EE_ X-MS-Office365-Filtering-Correlation-Id: 1d2ef127-c523-4c6e-0d8f-08dd1a528856 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: wID9Q3CA6fvhAPeDmvforfcyEs2ZF7Ef/TFeNldf2IiBxUTOD/RcnRt4XIABpCTbzcYicBus33FCOhWRcyucO2nGNumDCuCHyppIjh+fKdXRge2SMgvHRh5QD5IKhIlugnmoJ8nszSYZGo6K+kAsbTj/5hPcebwmsMXqtbbzYfu6NSqKHQs1oo3mK0EiXnf+Stenq4p+6PYSF475W/OGi+VuyCPSJf6PxSgwwflDLCVkyyrzVkBkQm/NTtDdRfzIuwKOOkalI7fAyLuAV5FXfZw/m9eZjPILxcQr/uoKD/C+IQioNqLjDE+dVTz6JCLgzE6xrhaOHlY73wT1lZrYREpDVKzcrfTW7Rj5h/9iGcJpLAj9PT24l+1uU5RDmTgiFjBZfps2/WT8uvGXURZ8iWCaFO/aAiwX3mjKQD3c6t9MYiBluv73bSavfzo51WoX60O/YZN0+gcUvn2gS3k2aITkETCm33X0vsHiJgZ7tiKRfuZng4KMs7LzwTb3LzNa37GPPuwIp3o0D88TcTeAZCOPngNhd4CKv4Se0aTZ4jeoU9Fbk8cmuChLecUVhx2uRv+1d63c2a1bH0YJZkl2pDqolU/jHdhnH/R3K9FREBbHW3vZ1sSS+lwfmifE4KKgcAmbcF8CBU1LVDQnpRjOTPyYfBGS8gaGoPR34ZHV1Ya+WGN2lInRo92Rc/dz8abEJ+huu8SBH8iWBn5lEDKymExq9dkp5X3GJWqkvfMe/2Yddwd/LemXjDwd3uCzuiT+EmoUPo6/m/bVlFXC2UQfWygy4uc/eNGabGJeJg76Qgb/fPx9zC+iheVlhdpA2oGc1ga5TE6S2zK5q9WC2tBXZgveCYLoW1DIpEGM9PTeBs4PMRYMGyk4UL9ZOvEgjdvGw+OUehOyIHhiPKdVwkQ4Vw0pNuABIVPIUvF131GFtf29Qp8A/ui5NrDhqi13dfRneS/92+OpdEOMsiBzDj34b0wilTQ0DfJ3ZJrH1Y2M5O2vcF+RUEGTjN6Tp1tGcUgbbUZN2TlqB87sPCugg0TRW/Pm3vvB++CdHMZT4gWkHSZ18lfxTG/1OyRWrr4FZNdiQL3iw9QY5Gjb4AnoV1AOhzgH0OHmYLQKspcPkTGK9ShJKk2aeXbo957DTLYgStaD6g6DhUtN9kP4HAEukeCnQk9mFfL/Nk/smQCgp8hPTCMWS72JCECpmg+W43drek0XOxfvVbdmR7VvPRlR01qE4MOD2tVpNzJY0LgaxhACQs+wsAPAWYkB993/XVo8hU+V5hModUXKUnb4DnX7sPZntTvfvkCbvVtOkxOzK5P7Wd2JaW9wwle2d9yPNWFRDz/7cbmwJfbG5CKaFi8sqyOn5uywaVn1WOop7h+lOcUVL2yxxU+ANZ4kFf9rsXOrKdW/8H+nqS9YzcTmhndfz+Ec3A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYCPR01MB10914.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(52116014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JQo3iNjgR2LoT4x5h36PmIgdxObjm/RNba4yhR398Z5lgdQSu9FBCfy0gLXvAjSyiu5hdXx3g/Tl7YYdaQKHTyA5ML2D2RwzIh5aKLD5piY/rQcyL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af3Op9F1RPK1VnN2MEMa28E9/90d8kAGJqyGBi/b7MlyfVSwILEp/NYCQ77my6BmqFMgy9hmBdz+F0zoWQZxDod/PkiMbTVIMNQ+CcBIVz+qXL1x/RoPWtCzDj7V/gHb5hdLgoxY6RhPGUQ/WMSiJpjElyyegj3BU/spsRqqpNvrHkyHw/rZTc2+3xnZGnEtWPVlVN3vnN7rBzEXSdHdyM6468O7ZNmr8VWGhbd6Ck7dK8T2nrPSRV1f3M0wDWEI3vFP4RjhD7Z/p/dKv68VuwivURQ9Oni+7+4SjnrvjTB0xWtDSja3HpPYzRDZnSPxlmWvuNk4DJDhhE9fxzepL6BzlTkVZ2L0XXFBBMDzmpryyTVb5Ev2jzP6UMHNF4pZGoJI7YPFxkSC1Fbk5r6SPFHJxAdiX/FKF3Mk4+Mco5MYMvWhtyc6eyukjwxR+toLnWPddY= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d2ef127-c523-4c6e-0d8f-08dd1a528856 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2024 02:13:13.4595 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BUx4pOPf80VLpMb8yGqPLShXF0B2V7eym8fkkUzPbYRX+lswgT8v1bwVVvAfSWWIF/hS90qPXMEoRseD+o6LKNezdJos2bngIrwNz6NPevxea4+VJUnJc7XfZENt10CS X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSZPR01MB7986 commit a22ae72b86a4 ("ASoC: soc-core: disable route checks for legacy devices") added card->disable_route_checks to disable route checks for legacy devices at soc_probe_component() and snd_soc_bind_card(). And commit 6974857c2b2c ("ASoC: topology: Do not ignore route checks when parsing graphs") tidyup soc-topology for same reason. In snd_soc_bind_card() case, if snd_soc_dapm_add_routes() (A) error, but has card->disable_route_checks case (B), it will indicate dev_info() only, and then, next function (C) will be called. Thus, "ret" will be over written, and it is handled as non-error. static int snd_soc_bind_card(...) { ... (A) ret = snd_soc_dapm_add_routes(...); if (ret < 0) { (B) if (card->disable_route_checks) { dev_info(...); } else { ... goto probe_end; } } (C) ret = snd_soc_dapm_add_routes(...); ... In soc_probe_component() case, if snd_soc_dapm_add_routes() (a) error, and has card->disable_route_checks case (b), it will indicate dev_info(). But there is no next function after that, this means ret is still indicating error, and will not be over written. So error handline (c) will be handled, and will return error (d) static int soc_probe_component(...) { ... (a) ret = snd_soc_dapm_add_routes(...); if (ret < 0) { (b) if (card->disable_route_checks) { dev_info(...); } else { ... goto err_probe; } } /* see for_each_card_components */ list_add(...); err_probe: (c) if (ret < 0) soc_remove_component(...); (d) return ret; } In soc_tplg_dapm_graph_elems_load() case, snd_soc_dapm_add_routes() is called in for loop (1). if it was error (2), and doesn't have card->disable_route_checks case flag (3), it will break from loop. If card has flag, it will indicate dev_info() and handled as non-error. But ret is still indicating error in this case. If this error happen in last of loop, if will return error (4). static int soc_tplg_dapm_graph_elems_load(...) { ... (1) for (i = 0; i < count; i++) { ... (2) ret = snd_soc_dapm_add_routes(...); if (ret) { (3) if (!dapm->card->disable_route_checks) { dev_err(...); break; } dev_info(...); } } (4) return ret; } This patch set "ret = 0" for each case. Cc: Pierre-Louis Bossart Cc: Cezary Rojewski Signed-off-by: Kuninori Morimoto --- sound/soc/soc-core.c | 2 ++ sound/soc/soc-topology.c | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index a1dace4bb6166..c8b7f78b02f0a 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1646,6 +1646,7 @@ static int soc_probe_component(struct snd_soc_card *card, component->driver->num_dapm_routes); if (ret < 0) { if (card->disable_route_checks) { + ret = 0; dev_info(card->dev, "%s: disable_route_checks set, ignoring errors on add_routes\n", __func__); @@ -2236,6 +2237,7 @@ static int snd_soc_bind_card(struct snd_soc_card *card) card->num_dapm_routes); if (ret < 0) { if (card->disable_route_checks) { + ret = 0; dev_info(card->dev, "%s: disable_route_checks set, ignoring errors on add_routes\n", __func__); diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 43003d2d36667..ae2d6802cce05 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -1102,12 +1102,14 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg, ret = snd_soc_dapm_add_routes(dapm, route, 1); if (ret) { - if (!dapm->card->disable_route_checks) { + if (dapm->card->disable_route_checks) { + ret = 0; + dev_info(tplg->dev, + "ASoC: disable_route_checks set, ignoring dapm_add_routes errors\n"); + } else { dev_err(tplg->dev, "ASoC: dapm_add_routes failed: %d\n", ret); break; } - dev_info(tplg->dev, - "ASoC: disable_route_checks set, ignoring dapm_add_routes errors\n"); } }