From patchwork Fri Aug 30 06:54:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shen Lichuan X-Patchwork-Id: 13784374 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2086.outbound.protection.outlook.com [40.107.117.86]) (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 AEF1E1531C3; Fri, 30 Aug 2024 06:55:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725000910; cv=fail; b=Z01/ioHRPniBSJV/tw8KRHMGT8H1q/6s3UAroLG4oHTkZ8q+x1TbaRV1T4x+rdJJfE+fJE2dKXho2bRdT+NM8Oy61llhlSOLMQIspHMYr4YX8+YQrixzWOs1IH/aFLPNNdEqv7YfYcJsF2x6qA8drENKzV8TosyGRAq/qyVaIbg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725000910; c=relaxed/simple; bh=vFzu9ShYrCD+1TuuaiGLuueCu4h8alTaCiUJpVvvLTc=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=XYP00XaVDPiVqVBnOXterlRWApGpBD7K/5tngvaudfy1IqwTpB1TTmM/+6yZUfMzp6jP3yQ4mw3ppa8aqBHL70ICWP+cntmQb6ySF1KZvaWBVTWqFqtDccHfpeiEyyzTMke0OU+kFdEXRns+m/2gj67Tob0sXFrVzIM8WauUd1g= 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=J/WC3hGz; arc=fail smtp.client-ip=40.107.117.86 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="J/WC3hGz" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uzt3dxRmbEimfxzBGR8I7NXtCAg/vbS2wcm36BwK9RVsMVUbgCW13vQ/gF+1jmj7ylRC/t5P8ZO73tzYdi813DWSz1yCiJ8QfJD295XuZR0PdPy97+f7dDMaP0iHj8+oMbjjXn7dLKwMnl5ZMxMmO2fEwRpKm5aXEwKcuUjUVPjtNg96D62vm8YZIAwnlj9lyqQk5GeFAa9beC3/30eLXG7SXzizTbn08szTcVadEKsqdP9dIvbiUuhyPJ40JSGEGhHt7ZBeQ97+/dPQmIpyPL0tOtmZ0VOj3RW22qoLlDZSv/ycz2zEEGFC+kFw11D+0aUKLm24WvktfuOzkfqzQQ== 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=aM8tizbN/UaP8LSJ21mzMNQCMSef7H7RNTj3cs2x6wk=; b=TrEd8oLjqCuEWZcA1lWIvKxc8kDGm+2WOzUOI+6eWvrMyBF4UeSvWsN6jx3h4fWIurP0rIYw8NW70sLi54c3eWYj/cBRHM0i5BDSCKkI+zIBOXsYmsBWB05/sGa96sewvLuqrmm8i4+SZRBD8BWx+b+Ue0hDrtHcvUK3KO9yMcSrdpsjcqa0PU6/gu2lIu+mZPXT7eC5Wqyx+/Qxj0zkTQj5lIofNS0yADgpvsv1F3Tt9lE4nhaquxMHEezlHlva/9Lekadt295GLi93LLm8X3AL6RjD7/4ZVRoLgxXxnde4u6/ANNi+qoD4Py3rHAZ0Sb7NaI8ZPeid4UHTX1cB1w== 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=aM8tizbN/UaP8LSJ21mzMNQCMSef7H7RNTj3cs2x6wk=; b=J/WC3hGzOpCqhbA6OoxdVjMicGpXQwi2OwZiuGiooIZUS0AGn3mDKU+xClLU7uXeoJYHI04PAiYqHqr2pN14n+UGcQPJou/wW5/oQGHdD0trzsntje7muDiHQ4BzZ+8owgnwvsJmFLzjFdr4HuNc1kDUNQUFn/slalV6MJFZdovccUGVkqQIjIodlacl+s4nn8ig5EBC9rfBpLWyUZXGSqmD3F2KrqW1F0vxkIZ5M6IkC2kGDsBFTlaGNXZHciGZuT0EFqsMir0no8XskpBGwgmJjRNFBy0FO2SqL2ssl2THUSjOS7+Udn+jVr8H0gkVom0Uv5xPC1Dx3HHsYc30qA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5899.apcprd06.prod.outlook.com (2603:1096:101:e3::16) by SEYPR06MB6397.apcprd06.prod.outlook.com (2603:1096:101:143::9) 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 06:55:03 +0000 Received: from SEZPR06MB5899.apcprd06.prod.outlook.com ([fe80::8bfc:f1ee:8923:77ce]) by SEZPR06MB5899.apcprd06.prod.outlook.com ([fe80::8bfc:f1ee:8923:77ce%3]) with mapi id 15.20.7897.027; Fri, 30 Aug 2024 06:55:03 +0000 From: Shen Lichuan To: jdelvare@suse.com, linux@roeck-us.net Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, opensource.kernel@vivo.com, Shen Lichuan Subject: [PATCH v1] hwmon: (sht15) Simplify with dev_err_probe() Date: Fri, 30 Aug 2024 14:54:43 +0800 Message-Id: <20240830065443.31760-1-shenlichuan@vivo.com> X-Mailer: git-send-email 2.17.1 X-ClientProxiedBy: SI1PR02CA0022.apcprd02.prod.outlook.com (2603:1096:4:1f4::16) To SEZPR06MB5899.apcprd06.prod.outlook.com (2603:1096:101:e3::16) Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5899:EE_|SEYPR06MB6397:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f041055-6431-4bac-5ca5-08dcc8c0ac53 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: en7Qw2HJqc+XJEg2Xc4F+kGzsvn1cRJ3JO97iv864bxGhqnYtGSeUhdGQbgiUP2ZjvcQK9ARU+yWIBcgbnfQD+SxGzmjjBsAkWNS6YY+LaFuQgp3ETeaeCrXFxLhTsN/q9k1h1ejNshziEsR9OJQ67B9rtyN7F+vEwFRfSWjs/sslHK0PERXEzn9isEpl3uU7mV7n7uFGQ7T8gkzqxTBrMJb6+N8HvqH+0/i2hdl+dloprncRD814K6Jzgi08gTe+KV8d5Gi0aX0inkx6BG+8V/6u1zuLl3Y/uUmAa63Erlw6TtROM8qTemk7nA86sBjdtCvlwvwXSwHF1+i9YmfWg4TTNDW5jvSWy1a6VknKpGaqsN/MRE+y/wgMdKaJksp4WY4RjuZy0xpLDYSPFgAsdQt73/pKJP+cfsu5+OFfhNslysn/DG0huyr2rafVhZJHD1ERabwL3hW2ZG4CkbO7+FDUDh/0QQ8tzI8r2uG5QrGbcYlCVBJEHA9ZJZP7R3j4K9AKEqVnx2eOSI36c+9Y9978WIwqwt1jP/oP/TOh9+0T4Rn+vpIs7tC7HVBl5BustFob4hqJdKDmo/a0P4oPrkkwLwQp/B8BSVpKDQ95K1pwSAe8V7cfXiEGJCy8BvQWTrwhv+I+6zMxIa5JEo1XONeusf4bdqxLVMZGGr551+CWaJJRZznN0XHnNl9I8cH8vIrSKfEqy5r7WVv+sIwVCobm1T6Vd3POrbuJRU3l2ckm2SeAenEHeGb+gg5lHFjiwQaLnz5EXrN7LTqH83muz8AKA5mWc1Kgfx13AQKz42LvN5rCoGbmO2z6094LmP3i9goHsOaLkpq+sk/RqQXSAAZ3T+GmteQ8YOAPhSBnaFYwG0+jKB+6McvJO6/PH1yNFLejK9xId1IYcgaagQVcSNqVLonbGzFLDb6/mnv0XYABC2lUB2koWzJDrUAmbz2XlNRNjHp9I64ZWB9jFQ/UwF3tSIzpdchjsze771u4L3B1CE9XID9EHz/nKqfSUf7uvm/75goqSOen8PyBt0ivFkfRhrYhKZuVOH1zqJ4KA0S1EifeF7ENWPqF+2kU5rolTXQBxSyP0KnZYH8VZYd9aiDjcO0NxwWgVTDPoeMgnzQJqIobbwKQwhemo38niWwV1igeTIVgfEu7m3jMTUpymJbt8EsQS+TP2X90VI+6uUAnMytpvlWq1E6N4+FPXCNAB/OjUwpPpE1+fWgbQjq88DhfMbbanSCBxklZA1ZbNQv8VBGoGbzJaldCbpzNLqgieHTEP7LCAUb6L9ulo4zmmU11W1hxB8oHeG8LS1nLe8LnNOqyJHqwiL3smYhc8Mruqc8WT7tINu6Tq05duWpasLRGEvEZD8oCFbhO27KFrldueqEAel42KopbIEkruTm9Q3WYEmW4cZJQio0vvsVaA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5899.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014);DIR:OUT;SFP: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HjA41RGkO1SIdySFzIWIUk620cABY2hGXSFQDRkEy2SqcUlFmWN21dsYK7SShh4IsJkV7GqlS1zm7HkWE/yPLPV8XJyAE7b8Opi7oKW4+Z/We3gQ29HJrn2swI+2JSJBdWAsLffSuSag+3ppRnyqtZBZpwC6jtPc8VxegY6UPrwsFaWfqkxs2/XAbYFkGoFwa0z0odTD3Qk1BDs39y9pAXen3gOCWOLfEs1rZPWTCD1+B3ZmKw/ionMlF9TiQJt8l2lE9xY755qd7ONZ1whJVQNe5jS9dX7UnE/Hdwz9Lc7MVsFOeZD3nnDcgoxArZ4VmRF3FNUgdazTjQoc2saArgF5vh23LL+7WJO0jdNG73U4ZFclIJUNrmqgKLmymPlMdjFf5/SIFC4LyeD9pHCBGBusho6Kg4n2dk+lfwTJilwmxEYg9+kBliRBTnvXL9X33+yiQG+NzYuV/nB61u+qWv1scj6l5PqsBVyFqwLG4aA9fZHNKviLxaAPPmsM3WbApE2jSCroIynJrRh+vcw+qChCAHQ4BrYUyxd8uB7VtodeJgflI3A2WN7oK1Mk+uS9G4jEX5Rp8dbN X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f041055-6431-4bac-5ca5-08dcc8c0ac53 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5899.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2024 06:55:03.2401 (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: CWFFqDcqI/vEqCYBvydKS3P2za+kebo2ychAv/chBLCWVIf+y8gmnNeWtTnUv64snInGR5BVQMNGk357w539fA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6397 Use dev_err_probe() to simplify the error path and unify a message template. Using this helper is totally fine even if err is known to never be -EPROBE_DEFER. The benefit compared to a normal dev_err() is the standardized format of the error code, it being emitted symbolically and the fact that the error code is returned which allows more compact error paths. Signed-off-by: Shen Lichuan --- drivers/hwmon/sht15.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c index 494f9655f44f..cc3a46a9c68e 100644 --- a/drivers/hwmon/sht15.c +++ b/drivers/hwmon/sht15.c @@ -942,11 +942,9 @@ static int sht15_probe(struct platform_device *pdev) data->supply_uv = voltage; ret = regulator_enable(data->reg); - if (ret != 0) { - dev_err(&pdev->dev, - "failed to enable regulator: %d\n", ret); - return ret; - } + if (ret != 0) + return dev_err_probe(&pdev->dev, ret, + "failed to enable regulator\n"); /* * Setup a notifier block to update this if another device