From patchwork Thu Aug 29 07:20:16 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: 13782691 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2079.outbound.protection.outlook.com [40.107.117.79]) (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 C32A4210EE; Thu, 29 Aug 2024 07:20:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724916032; cv=fail; b=agBkmZ/0P+VOy/kUEj2cYv3MKbpseQLGJuplNGdw+rRhQKWTZxjIKYYTt1ye4eIAKEteiP4hwuMGZCwqh3mqnoI+nJDZUUm21AdL2xpCdR7B+BeTZtVm1VsVBoWbS/rzPGIo5NcVbAzzF/JdcOkjQy7IWMuljoU5sDg8Isg+dDU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724916032; c=relaxed/simple; bh=IWKSC3pDAGk7yBzUnitDGYZL3fnx3ApY4CElOZPiako=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=kloulrGaHROBeqEp2E8FBat3eZVdkuPkosbXXW/aiR0mBhWIqvq1qUuGOVLaPjK6SpGGp7AiR7SXexwKQv9IFSLFy0XiBQRN2RP5zX8k+glZxHgjKrmNiTEBp2aqZr0d77LGAO6T3yoSbl2Wc17D+4a0G/jYuigF7w1Z7awQwI0= 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=WCBxHr7v; arc=fail smtp.client-ip=40.107.117.79 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="WCBxHr7v" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EmwNJKsZKKPuxqgwcgjov3tjnmEPZC0gFErG7S4/Sym/i9trw9pMzUW7iyu26opJd0DF82yqXWnVAHpSGr5qfm9PqlLMmXa08xbhyckHNlJthCFX4wzh0dthgt1ZQZl2pxmO3yJGZ816gTa3eoDH/SxeBF0gbf57a6I6ikjWx1QkAacvql5w82qHHoiGkmkVBbRgT0TnAT+IP2Vi2I7Lt/un7RPP0U1dXu9tl58OQXLVrvezyV+yU6EBO4xKrRk/2i5Vbfr3fka5Pi4rJP3D0eLje0oCwlU60Kw8DycY8dCf9JmSkqPCh1lVhO5Wb6fr2yx2SVCFV+3bXD5i8NZ6TA== 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=Y0Tztwz7vGOnGQh4vVk71C5hgRJ1H1K201FaQMm3bko=; b=C6bx8KyXgGt9gonWzNZ9h0jcvX6q/3m9Y0Rs22ytLNnzmB0rfadPIFJ1SfZsnmh6lF46c+obb3Eb6O/6rO4GLaDvmV4LiwSMfAa7r4Sm4EpQQ/fKRnl5VQ5gvAXk052ZNkjR280uSos0roo090EMXkN0KJR43OK9/89ovXeMRjzgT6ihxoCtqnwQkY9l58a2w/uxw/Kmo50Q3+W6kO2geTOHkoeFHncUNPvai88mE59UT4lndZTvywSFmImBbkpQfNZJyTuYx7rhjbS5xKyzhkK/SkcACEouiRtDVU/i+2l2974tO5lz25d6b45x3lDm2pXO/zyJjwkXFE1nDZEozA== 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=Y0Tztwz7vGOnGQh4vVk71C5hgRJ1H1K201FaQMm3bko=; b=WCBxHr7vAFWtJebfFl1CPUkFB6gBGaXdvd2YKHAb6SMqVYjiUyP1xO5fejyY1m+udddLandElxOn3vZ5kp43OGxp5GBO8KrQJpU00RQxcSz2fxHyUH6xQrbvjTMTZa4hsxU9Mgb3eRU1OeZU9PUHw+fZAe/b+n9FJ30jarBOfylcC2JlCpc4BPjLYECKq9SRkh/ywt6ili0FId4nefd1+wYDW4bjBMgP881OcUUKPcusk1iv3x8HzPBudUOSeTb0oNbhOKW6Fiv+L42Nsc2oTnwGmiLU/U2ZCQbbZbjUAFRNKOwoktv9xdDuhO5WBKKYEwW4SYeZcMvbkLjflLZd3Q== 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 TYSPR06MB6605.apcprd06.prod.outlook.com (2603:1096:400:47d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Thu, 29 Aug 2024 07:20:27 +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; Thu, 29 Aug 2024 07:20:26 +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: Simplify with dev_err_probe() Date: Thu, 29 Aug 2024 15:20:16 +0800 Message-Id: <20240829072016.2329466-1-11162571@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: TYCP286CA0322.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:3b7::11) 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_|TYSPR06MB6605:EE_ X-MS-Office365-Filtering-Correlation-Id: f4fd70e3-a27a-4d50-af62-08dcc7fb0e06 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|52116014|1800799024|376014|38350700014|81742002; X-Microsoft-Antispam-Message-Info: rw8gYGOg3mpERmadJv82ZK6os0HEZiHSjZETSamQb91uiMiCgY58iSL/rkOZHkehPIev8MtZ19D6L4EhmRQafg0AJanS8ad8LfgLBneXbv3SEAxeBFfhIREimVG3B1R9Lz36DDc6zzbn/0x/CVJIP/P6Jpm1XvxBe/40JoebZcih9VK7U67lkOrJW5zLui5bGUYsEU6SComLZ8+NJjWk7R2IGy3V6SrKnggRwOzcvzEZ/f0YNGk/ZDXyWcQ7IlVz2YEuyY/RgObymBw1/bepCwm8lFOgQJ/eIouInGRqxYcQn79tZCwDpWELbSVI+gTVortiFrI3JSUeedHZyQigEXmuphoW12uDEKKw3rkY3hD4fIVNMVZiE6FXQP6dOhOeRI9szXyaQofrcDOhjQNEMlWhOHN3XivZ9dPrf+KuV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:;IPV:NLI;SFV:NSPM;H:TYZPR06MB6263.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(52116014)(1800799024)(376014)(38350700014)(81742002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dZ/jIFnYDiSGMOm2NRlENqxo7PeWv4kwgtex6fdx1c+dgtWKhjD2eDKEpQBJT6c0JaqVyMZM+Ex9HRzZELDv9s7vOT9aN1ccForqIYRCZmZJn7rRw9v/PsKAo0oOM57iHOJjZ5vExf0yLLmGk+QSB7KedrNPALYNIEBs4L4wH0qSVOg016erNIlQ5GfW0RsNBNsb7zv6J2IuPAn5MXto4hd0Ik8UFiPVY1PihZeIWjnlf3qLWWRU3F0DzvU/yw+EmCPyl2tCKEFtqw26Ac2S8RewTq1PDwvUWVlLkWlp7n/T+CiAK2lKBvzWSkBle5OQQ7iJGM0NX8SlN1eetHU4LgE88LmdhpZFmt/SFp/vJuko5wSLulFY7E++ahCGfJonFIhlv4VrCQ0MQHzIN+P//po8b//vprruezpwKvzf7sE08SQORsD6EIPp0itT1VQggP4ywzqFPmZYzia6dDmnMJGayWjzO9RHEatr65rgx6IqNhW0p90WD8X3Tf/uPouzMUsJ2rUyWjMpTm7ns4XWvnvPBubOCDd/qFF3SUexXZNbw0QeAfnUib8/GQHwgBl+uZZ7rGr43/4h7wc/GVae/j4jPXZIDRfOA5BI6RdXO336L3OGvZW7+0yUD5viV/CjuWxDA33GgzbfbR9rkx7sfwog7Rn+HDBMjQmff3DW1WMYGbiTKXL0MHbjG5SVWyWrmuNQkGdUpT6EAQlKelh8SmIYjzrlj9USKGyRi/wDN0WMvGjp85r5pwSxvHJBVv8ZbJC3lyi48hAtuyQx5zmpAG0wPUN2tsYzZYpsR+Rt3XoHPqHSoDlWk0G6CIUyQxV8j45KxQyCaf/m1PrdN/bwLnexl6f+5AAgaSCSa4h9ZPsb1ji4ojjrI4LEGfmIZZYA65rZtIAxWH93DJ4qpUZx0DUny0LlLlytaEk1GtXa6js2+6zig3CyCvdj9kD3xAg1uo2r//ftk6ncrioS8JyER17dMSuhr+KRItXPTC+vlTF8QLxcLXKxB3RvgpTsOvTGqjtRdI9Q+qz24N82F5aMf+sJScZb7NHFAqab+1MpOIxpnNe/id5ths6PObrIsDTturKJqfXO++C4wzQsbxG05kZGVFRhBafCbxk28MkBjOnFnoGxVpVrYLOJsrPTsHQEUExe1JMh6Y5MAxhlNWiigaaW9/KPqoaxGz1Ncg9H/r/SMOAoWYZs4ILADOQDDter1SBTWq806uEI1a7pNwaKnOnPHkfamO4ZQ986/nskuL3yn5DaCQ/LxsPv9vvo4k7UmHScYcryqSDo9aea5aUfZ04ncQOznLOzqwgzAWIwidekB7NutLusE67r1PXnmEf95B6wc6dPKkqWj07Sb7nrmXTVmzyrXMyrz8O+v4LgYdF28+pVPVd1YGhh9nBptHnp1aefLIhwkCRHeKwnPJCXp1aJuTkHAjigsh5QKzggkh1JfBLuVDMr3z1EG0LsfyEg+YR0nyfLf4sh2BRd1lemIQ/7GFun5fnBajZUHjzpZxKp9frsL20Ntn86zmozxaQajdcsnITziru/iRkVjhq3jK7XhuiKiXo1xnw5OR/f6RIfwKygq/X0hV64O9tYX3nV X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f4fd70e3-a27a-4d50-af62-08dcc7fb0e06 X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB6263.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2024 07:20:26.8081 (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: nZ1VsDuigsG/eaWrXDEngxf4T5pt9EKpgESq/WH/fMFQI58EESySH+q8Hu4v1sTDVSfROnmvyBB+or4sRBF4GQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYSPR06MB6605 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 | 4 ++-- sound/soc/codecs/adau1701.c | 12 ++++++------ sound/soc/codecs/ssm2602.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sound/soc/codecs/ad1980.c b/sound/soc/codecs/ad1980.c index 3c1ae13c1..25fd8bc4f 100644 --- a/sound/soc/codecs/ad1980.c +++ b/sound/soc/codecs/ad1980.c @@ -239,8 +239,8 @@ static int ad1980_soc_probe(struct snd_soc_component *component) 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; + return dev_err_probe(component->dev, ret, + "Failed to register AC97 component: %d\n", ret); } regmap = regmap_init_ac97(ac97, &ad1980_regmap_config); diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c index 8bd6067df..9fe18b22b 100644 --- a/sound/soc/codecs/adau1701.c +++ b/sound/soc/codecs/adau1701.c @@ -678,8 +678,8 @@ 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; + return dev_err_probe(component->dev, ret, + "Failed to enable regulators: %d\n", ret); } /* @@ -799,15 +799,15 @@ 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; + return dev_err_probe(dev, ret, + "Failed to get regulators: %d\n", ret); } 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; + return dev_err_probe(dev, ret, + "Failed to enable regulators: %d\n", ret); } adau1701->client = client; diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c index c29324403..727bcccad 100644 --- a/sound/soc/codecs/ssm2602.c +++ b/sound/soc/codecs/ssm2602.c @@ -606,8 +606,8 @@ static int ssm260x_component_probe(struct snd_soc_component *component) ret = regmap_write(ssm2602->regmap, SSM2602_RESET, 0); if (ret < 0) { - dev_err(component->dev, "Failed to issue reset: %d\n", ret); - return ret; + return dev_err_probe(component->dev, ret, + "Failed to issue reset: %d\n", ret); } regmap_register_patch(ssm2602->regmap, ssm2602_patch,