From patchwork Fri Aug 30 01:47:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Ruibin <11162571@vivo.com> X-Patchwork-Id: 13784101 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2064.outbound.protection.outlook.com [40.107.215.64]) (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 1239D4690; Fri, 30 Aug 2024 01:47:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724982475; cv=fail; b=lGwMV3gn6V7Y6qyYn84VzSGFzZi1B7hUxdF0K2GsegL8k+nL6K2pBIQLJS94FivjVpuzWLHAq3zWayFxTy4j1nMrw9lyMvgQY0tK9HCbZ4zTFcJ+ITwX3OfRBLrvLZ8LzvwPfcLngtlYIijk2dUfUMv7qb668bAifIVTByiTD7o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724982475; c=relaxed/simple; bh=A15YJzY1qhx8KX1nJzNIBo/WJOJtf4o1q43EerfhYkI=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=g0fSOC0muhuKk4O3U1wC6V31YUPl293XxyYf/SN7oQ/+dSH280EkBz6qFrC8iJ0NFId+e3flo+lU6o1T+NrDY1jcfydrDxpy0PbLPy3Fmts05MiOL0ZBF5SCBGaD8cbcCS05czdz0h3jarEvmDKzfo5pBMidwAJ46gImR3q/B4o= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=l92OZ3OD; arc=fail smtp.client-ip=40.107.215.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="l92OZ3OD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=I0gwWT97K48pGZT5JV26W0GRtGSYfemoC0nQk2Kc15GzKjll2fNJHInSLcGCSMN7AolYgBlntx++TfyQM6AeYraKthFjY+PVVlqDgEXRUFM3/knEIkAu2PYOlKMWTxe1iVMQh+SVQV3V/EaFBQL4iKzpwIj3BGe3wl8YlKYIEFKbwNLhZr+2aWorY2qQenDyNlli8Y9vwXyjkS+70bV9OhaXHO2Cvd8vVwofa/9wQJZh0cioxYxl7ZIO7SIlFBD72bze7UFfNAEC/R1XeHuF+jOEISkUWchIX61y7TRbevw1a02NDoI7o7PmwpRH5THAQTl0BPkE/IxilYcKOmnz4Q== 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=wbjuffi6XHC3kp3srWJC1x1H8hOZ3aOyE5nPqHHx6Y0=; b=a4HR4Kc3evt69hnwQX3O6HIY+w0DZilwDaFbpNtt72fU/zxEtpVNGXc9Ar2ufHS9FDEmJA29jN56qhMGxgogwHsa4qXP4X8bPpBeO/meHvhrBXYvzlmBD0/XZI0qc2ht8ft9Q8cVk0OSNIbJdX1zmtIOlh68D/0noj3WO+B/PygbLpJTMMpz+uLtrrCcpy+PsKUnV20Dm88mdjYm0Kssh40lJ+cXN5sUjJBB7diF9OqMLeJCEe6N7BTnp/J2NIQpnAk78OWXM82z8tvpUOcnIznIEUUfGT1cK6gTxyAxu6DfkyrejmHMLVfJt6N/Ccd2quBnbZTCZHULooL0xOtYlw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wbjuffi6XHC3kp3srWJC1x1H8hOZ3aOyE5nPqHHx6Y0=; b=l92OZ3OD/eY0KVp9NsDap6oXOchMEmRI/JFl+drpUhiCO1iVFKWuKFiLRn1hXTN/QE0JwRAxmrTBpwTJfB8B0TGgMoESvcGetPqSkGdEpgWm0veu/tES+kRqvcwAp3NuXHlE7xK5zUjmRJBXQG4Y1f+YUJq933mbYgzgUBbb/kctbVwXYMs80yqdDRUUG3koHLH6pL47aJMdvkRdNURH+x9Ji8nGW723Qa9RqY9wX8i0kqiF8yFleIPrYDkm0eWfsHCNsfFj86Vxn4kE9wWmbHngw+EBfGXtTbTFD1o8i296EMgshJpC4R70mgpSWc8Y4xyNRoaeGj2s02JBbcdLXg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB6263.apcprd06.prod.outlook.com (2603:1096:400:33d::14) by KL1PR06MB6071.apcprd06.prod.outlook.com (2603:1096:820:ca::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.20; Fri, 30 Aug 2024 01:47:47 +0000 Received: from TYZPR06MB6263.apcprd06.prod.outlook.com ([fe80::bd8:d8ed:8dd5:3268]) by TYZPR06MB6263.apcprd06.prod.outlook.com ([fe80::bd8:d8ed:8dd5:3268%6]) with mapi id 15.20.7897.027; Fri, 30 Aug 2024 01:47:47 +0000 From: Yang Ruibin <11162571@vivo.com> To: Lars-Peter Clausen , =?utf-8?q?Nuno_S=C3=A1?= , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Yang Ruibin <11162571@vivo.com> Subject: [PATCH v1] ASoC: codecs: Switch to use dev_err_probe() Date: Fri, 30 Aug 2024 09:47:32 +0800 Message-Id: <20240830014733.3467006-1-11162571@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: TYCP286CA0006.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:26c::14) To TYZPR06MB6263.apcprd06.prod.outlook.com (2603:1096:400:33d::14) 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: TYZPR06MB6263:EE_|KL1PR06MB6071:EE_ X-MS-Office365-Filtering-Correlation-Id: 9e3fc521-e351-40e5-f297-08dcc895bf72 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|52116014|376014|38350700014|81742002; X-Microsoft-Antispam-Message-Info: 8NFc3vAKPpFXwFA22EPp78m3CXr0FXZVr/0B4xAaDXXvFAn++/2ZlExyGhZMpho5j5jm/JCrjL82Vsq4rxPfYDAIm/5IEgVBfqDescj5Cmfd+jCSRJMMhniqUycc1P23sVAfYdZRB3yD3JhKQZE/F4UvSn83JEWbnjLDvaHawkyMM6rPdAJtw0biO8Titg+UaZoMuuvHos0ydyroQkRuvkUL5LiSQeFlqdLkzDjxwOQsePtcavLS3OjpbYFis0TqRx2HTgGbxyTtI352xf6TwScb5UhCQ3ZyZRi1dehMey6zCfFtB5GT0YwxOTjtukGWya/gYIceNgNEwkmgp41FIIM1d2ZA+54W+oEkii5FKVihfdZem4sqRpI1a9FUch6Ui6j07wOdCfmuCVsj1FnpDUGqA9kSgMR9GukNoUBAG1Kws/xXdbav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:NSPM;H:TYZPR06MB6263.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(52116014)(376014)(38350700014)(81742002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: F9pLGWXWrZZOdp/JSlRXWf2qTf9cRzk3GcwcyIZ3bemu2886iHjFm5WsWxDic11YPc6k8WbYJYIOyyL6llOWcJ7SJS1DGTpTsuxPz1THJIfZZhAZN5sbBYtmnheUXpXciRngKFaX5AsGYearHKT7jEOK082Qisk28utcQrXltIjIrrQ8Q8fnuUBXlzo93VnFR+U2ANt8rV6nWPIHPoZ+hhs81iLMqnWahsXc5SZyZBAo619isfiG7+7tAdzUoUszELxR2/OjaiA/ttdD7TIomO5A3s7h0nTy8ZuEgk878xCycri5SDpazcp1YywfHW/m7O7CTIQnISq6pa7UhmpgQ2AUidSzw8dFoxGWplkWtcW/yhTL2aP+vSGuFAhd7YPhfJZMxfNr/6G8DSL7PN4cisWrts4bY6xcEthFiKG9zu8hm8c6i1Ed2+neRqhTYnB1iu2nLO2u+e3bXGDqPAGatnW/3YoqrMrB46LzlUx/oAK/tSKS3Qel7TvTzeU3PZ4GdFjTkU8wuNYycESDsMuTPNRELismUwlAKl2L73bYF5YxiG4Hy2D2+SxPJO5A+GSRUhFpHZgkYVfUB+SK98O8T7Veftuv3JWPWq41zpxmtZL9ISKnaAdyO61MQTzdiIYmOqDLiRiwTNxnqHM+rj3IIYrRTorZtM3Q3QRPplITRZ9tU/5TRKdQMp97OMm/HtahVnCd54/RYOBi1cRWB7ALBPQsmZBikTvKIKA5yCITXjtvmKavPQnsgLGfgKjmhN1R0SbkUlv/W4g8nm/T7ua4G7RRkCABNQU0d3mXnsgwxOoKuJ6N6RnxAxZo00d3PMAszZkIJpetgx1gusB2uEiHH2Xc4qqT/pe74VVRp9IOQytlvVo3OUmj8jpyLUl5tzoL6Af+OOn6PtZ5fUyQscggNkdjvdRkZsVIZpdsVpOZm5iKkT0ZMm65b945ThpYwQcV9iClgPq5z5WJbnrULM6NUvzo2Fz9UUruOqyKx6nPuaXG+iLYYZM15OMDC1jo6fOnvP/oXTweDWfqDm1nVuSZ0BOm3hwWdXDIcJNJyabi+B8hjf8OUFlXSeAQIFwtX59XAqXIe/mXlrecxU8IyU78ZNRCV6RwfubvGyLFb89et/kqVYxDx83ojkxYediLMAMmzy909/70l2a8KM6VpEt7uzTfFqOeBVlzGBMMspoxXszX3D3rcMj9X6IBKoD/tHjC5Orwj/RJL5+/o7n0OJTTUEOSWmZYSWRL90eWs8gmK6Rd8ebqgD+j1uW74h7fHt1QyOlygCekOY9M/G3aHQlqRcPJyTi0MXaCNvPX5PYgL/BgLR8kcTkEKdRc+vSNqSYumzWeoIns93fqHjra+e7mysF3TYP9NdkJPkzZkXS6pvwPAN+4q2kV1C62Zsrduca7TRrrx7lt0HJ0h/JuGDlyjY7+OV4QGL6RG/xsAhnpkbqvkczeDtlwR9TAvU5AMHlOQmktwhS2IoBubOuLh5yFzdskDOeOSWn8uGpE6wCjfVMHCX4tQI1cZXaENjoGVDGV0p9OHQaPSz8ECjZeDm8S+6537/KDEuGHi9QILG35pdUbPV2EqsBYbQYh6MulWIse X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e3fc521-e351-40e5-f297-08dcc895bf72 X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB6263.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2024 01:47:46.9663 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yIFay1YPihHQU/+PduZI6ucjRUV+kFxpaJBSJwKs/ZGrghOhYgdgwxx7vcQc76l8Kg9xeaORHJSBUwvAyVBAnQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6071 Using dev_err_probe() instead of dev_err() in probe() simplifies the error path and standardizes the format of the error code. Signed-off-by: Yang Ruibin <11162571@vivo.com> --- sound/soc/codecs/ad1980.c | 8 +++----- sound/soc/codecs/adau1701.c | 19 +++++++------------ sound/soc/codecs/ssm2602.c | 6 ++---- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/sound/soc/codecs/ad1980.c b/sound/soc/codecs/ad1980.c index 3c1ae13c1..d2f679d9d 100644 --- a/sound/soc/codecs/ad1980.c +++ b/sound/soc/codecs/ad1980.c @@ -237,11 +237,9 @@ static int ad1980_soc_probe(struct snd_soc_component *component) u16 ext_status; ac97 = snd_soc_new_ac97_component(component, 0, 0); - if (IS_ERR(ac97)) { - ret = PTR_ERR(ac97); - dev_err(component->dev, "Failed to register AC97 component: %d\n", ret); - return ret; - } + if (IS_ERR(ac97)) + return dev_err_probe(component->dev, PTR_ERR(ac97), + "Failed to register AC97 component\n"); regmap = regmap_init_ac97(ac97, &ad1980_regmap_config); if (IS_ERR(regmap)) { diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c index 8bd6067df..f4c574447 100644 --- a/sound/soc/codecs/adau1701.c +++ b/sound/soc/codecs/adau1701.c @@ -677,10 +677,9 @@ static int adau1701_probe(struct snd_soc_component *component) ret = regulator_bulk_enable(ARRAY_SIZE(adau1701->supplies), adau1701->supplies); - if (ret < 0) { - dev_err(component->dev, "Failed to enable regulators: %d\n", ret); - return ret; - } + if (ret < 0) + return dev_err_probe(component->dev, ret, + "Failed to enable regulators\n"); /* * Let the pll_clkdiv variable default to something that won't happen @@ -798,17 +797,13 @@ static int adau1701_i2c_probe(struct i2c_client *client) ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(adau1701->supplies), adau1701->supplies); - if (ret < 0) { - dev_err(dev, "Failed to get regulators: %d\n", ret); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "Failed to get regulators\n"); ret = regulator_bulk_enable(ARRAY_SIZE(adau1701->supplies), adau1701->supplies); - if (ret < 0) { - dev_err(dev, "Failed to enable regulators: %d\n", ret); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "Failed to enable regulators\n"); adau1701->client = client; adau1701->regmap = devm_regmap_init(dev, NULL, client, diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c index c29324403..153eb55a3 100644 --- a/sound/soc/codecs/ssm2602.c +++ b/sound/soc/codecs/ssm2602.c @@ -605,10 +605,8 @@ static int ssm260x_component_probe(struct snd_soc_component *component) int ret; ret = regmap_write(ssm2602->regmap, SSM2602_RESET, 0); - if (ret < 0) { - dev_err(component->dev, "Failed to issue reset: %d\n", ret); - return ret; - } + if (ret < 0) + return dev_err_probe(component->dev, ret, "Failed to issue reset\n"); regmap_register_patch(ssm2602->regmap, ssm2602_patch, ARRAY_SIZE(ssm2602_patch));