From patchwork Fri Aug 30 10:39:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yan Zhen X-Patchwork-Id: 13784909 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8237FCA0EFC for ; Fri, 30 Aug 2024 10:43:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:Date:Subject:Cc:To:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=0g9iYfqWRBrMxYc0RRK7XuXREFEuviqjtlU+5yC/izY=; b=11s6UZZTYuYurRUOpr8J5prtZs RXYHwb4EE6O2ILT6N+Rd+P3eYs8r4q7s0TdmEtv93if/THlfB6Bh13EtuUUc6omyhyFrKYsq5VuGi DP5FVyL++JNXtPWTZvR/rGiBK6BjCFI6r67rslzYBw7eEBsTecHFRE46W4tRS7HGeLeBmApb554ql 3juBuycIfaM9AZPNiVOxZnyfxOPAMokaPaDUZuMOh3Nw4txLRiPN6UYMsEvGC1fGasSObR+BYLtGC sM0iZ1H9Mop+zMjA2tETAkVMroZihMOJmeXSy07qBW9ICk4KG2sbxrbLMZvpgH45LnwKbA2mYIOz1 wZT/LvCw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjz6L-00000005sP5-44gw; Fri, 30 Aug 2024 10:43:34 +0000 Received: from mail-sgaapc01on20608.outbound.protection.outlook.com ([2a01:111:f400:feab::608] helo=APC01-SG2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjz3c-00000005rps-3AFm for linux-arm-kernel@lists.infradead.org; Fri, 30 Aug 2024 10:40:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sWTionfstYjrAYXNF66edDCYTz7wnVEMd11gCMXemBQy3eyG/OOQQLC2WboInV9kVEhUwAUllSbm/JmKxClwDzLxPbi43XgYnMgp8Jvrr4O/QLPLX/y10XV5dI0CTRAkss9J7n84uSMSRCDfAXp2TY0hUiCTp8jEXYympE3hYAHzGcKptSAyyDNZzlYqRTW9gH2zpucA350iM5Qv4iitUfaXilMpKxHlwlQvAKNxlXnaAfr4Dkwn4TwvL4fAeXOa8KwroAzSmpkIdX9lr8mGjYciK0CGzMvlmC5t6wHVRkIxSY5EaDaSLS9fPsNzGWf1d9cGA3UB5/rnOySIooU0+A== 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=0g9iYfqWRBrMxYc0RRK7XuXREFEuviqjtlU+5yC/izY=; b=G5zSFET4xwqxYqvvgf1O4hbwIE3+Na16G0EqgDoRyhKBPRbNLdR5gJlDz0h92ra/EMVprFmVoHCa8Cyc2p9KuwYkGuaZ49KW9at2ZQdBFBXRrborTDPIG8aUdzCui+8XZCum3VsU/883zW2Fs91cbTT+FzNLCOmcmpT1GaX6Kbc0w7SZWCBwnf70ogGE1NyVWIvVfLAaz36f3Q1dpZlC1AGvTkcsNK2Eh1eP0PcyQbYrenuq6U/rFGyy0NNnjt+mULD/vFszsCwz3sRF1fkcjuFpVDLIK3ehtSG4peVSz31ysK+eEs28FtUw8zBPbOVXwBNtegB7FbUecYsW7SfZJA== 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=0g9iYfqWRBrMxYc0RRK7XuXREFEuviqjtlU+5yC/izY=; b=MFzZXQRD57cp+QVTZq6sjewbslU6l1IzMBcv5WkyGtcQhEE++OGZ6sXQk8TcqqIqrqLCpP+EOBMkrA9a40u1G75Hb8J/iaLnHXmbD3KCSv0Eo0WoHy8aEhOcVrjy72eN5QOX/kubWDLiGEsXM10jHyfsEi5vcyENpZLULMLr6W2dPsGtqkdTRjJVR41+OCJCbDiwwnkg7237DUqjApG3fcCiW4pFkiB2o5GmsIziQV9JbnSwI0JqbsENTBEtNzzLrA2+j4Q5NP5TH2rPoV/7nx4MbCg+SvtMJMO1Tw3XPKuVGFY3hgRISf105VcFJ0ecM6ktwe1pHaRXl31uo8P1sA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from KL1PR0601MB4113.apcprd06.prod.outlook.com (2603:1096:820:31::7) by SEZPR06MB6667.apcprd06.prod.outlook.com (2603:1096:101:17d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Fri, 30 Aug 2024 10:40:25 +0000 Received: from KL1PR0601MB4113.apcprd06.prod.outlook.com ([fe80::7e85:dad0:3f7:78a1]) by KL1PR0601MB4113.apcprd06.prod.outlook.com ([fe80::7e85:dad0:3f7:78a1%4]) with mapi id 15.20.7918.019; Fri, 30 Aug 2024 10:40:25 +0000 From: Yan Zhen To: mmayer@broadcom.com, rafael@kernel.org, daniel.lezcano@linaro.org, florian.fainelli@broadcom.com Cc: bcm-kernel-feedback-list@broadcom.com, rui.zhang@intel.com, lukasz.luba@arm.com, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, opensource.kernel@vivo.com, Yan Zhen Subject: [PATCH v1] thermal: brcmstb_thermal: Simplify with dev_err_probe() Date: Fri, 30 Aug 2024 18:39:18 +0800 Message-Id: <20240830103918.501234-1-yanzhen@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SG2P153CA0024.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::11) To KL1PR0601MB4113.apcprd06.prod.outlook.com (2603:1096:820:31::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: KL1PR0601MB4113:EE_|SEZPR06MB6667:EE_ X-MS-Office365-Filtering-Correlation-Id: a30b84dd-c04c-4236-7edb-08dcc8e02852 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|7416014|1800799024|52116014|38350700014; X-Microsoft-Antispam-Message-Info: I8YdyE93/zLyLSa5GPKtxWKE9xepuXDcJJq1mpQT1lgnJ6MAlX5kJURwhciWyKLr9Q1g6wOkAeJBjyxbquOas6YRu3jPx5wsQSu6zNOp0MF2Ubh6KcS/Z2AdNngG0j1ZrMqZf15urRNI7lOwVOexWTVL23Wq38QQ8fSGPSrVccbm+V8Nlc2yGVGJkpIpqT854Fx7NwW3czwbxqKekMsmleploC7LlJIzYhIgg/uVDHCIBGPnmngA943cG8zeqfho0tHnxOrFQWFTlFJvD3yg5OzwtZEI7kUbp2yxnGVffWCNPnUbPBcRSmjb/FmGlgZB+Yb0U7zpS65e/0S0z/jd2nvtnXtp9UwEl3vPwzIpeYE5Iv5dzQ3QZJX7gNmqabCBNwOFsKud/4zLU4YFNLGR6HfKClpPE/7WE6mueVfT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V:NSPM;H:KL1PR0601MB4113.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(7416014)(1800799024)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fDpqH34ia+Ox2+OG1GlRNGyrVF/57K3XBe3a2pEXwgdYpxEPX0KGyh9GrETyjdgpqV3J9LKJCXQi33cc/ae1YSyk3SHoxU+ukxz3M17k+XGAYU4+DtW2mOkrCe6dSmmTXSZtFHI7aiNS5E2de2mjeYXLdHCkx8DNXayBekBrGPndNnvE9am+6uOq1SeQCD/OQOYjUNNhxJb0kMQw130tByv7fG8mmOMZK3mjhD/PE5S97dO5fAvQopBJthnT/vliEqS90BM9h2/7WiuMDz2SnGBS0uabkP0xrbf2lotHxIGXI05iC0ZedCitgRgrIvw0kHAWiEyGcSQjKyU/OxwMmzotuu/Mjl8f7djlk0NbWfCaydFe4Avgj9quKci6LS++tCxo3rkPZbqATVDOgtcsjbwO5WWz5JdtmUsHQGSk5N44yzYxry061LsqVk1DgERawlNkkMACqZQwOF8bklbTZeW+Su/IVvGa+erOX423MBJ9jCCrqATzysFq0O4yq37sLxGCOFBJzM2Jii4jiBaORr4VN1wL1xA+jEar8+R7l836HQ1P55d2qxKmWg7m+0d5OhsotmuF3LxHoFNceqFpXrKQf5pOZBtPFWEsWEulqpXEpb4VtOn/Idpt1fg3ese8X36B70V2+a8x+2N8IFwNi4BH+98HlIwXqwqYkpPtBt7o533b8FPTmYgnN7odLW6FECI8WIPe2qykziCYQuIYqJcZ9dplTI0wpzp2pwRuKZDR6yFf0Iy2r7IUdcdr4Sy1H2ZnpZgjF6XGQBWhDfh1U+E/gLFLu0R5ETcQGaN+dccQzjn9g56m40vWeon+gSn0sgY6TW+AlUGbkxadpb88FxkWTfKb5kuq9bkKg+AgMEp4lB6K0CXicmdzjI6O21kp6CytrScKyBvnrvOU0PX7XZxFu2x52uGtZtUAsP+v7mveaIEa7tAtt380xdQ+WuuSAlP3L2ea0FW7i884KvWrLjrVN9Z3ffCdbtpzS4tqPJSiajWIHC6XV5bhXBk4IJdUY7rDpXTN3ns9rZKA1usMSUyDJnTMSWA3EjEmzEX5qRaV1ESkugTGDWe2cqNa03Ydu3uxI2darHeGIypP4q99tGsJ23lqfyMYmF18YM9fEJQ1pP6BNOYLdSiv01HO5BFO+NiCSrkL32HfHSEYoYv7Mb4Bo95A82gfMYeY0YrUr0h1BMUzX65euB27AajFSW8xnD8t2ZbzDhRBgRe7v2rabpS+eOuydqVDGY54SOyAZ7bgpEKW65SRg4JDLu02Nuuh2a/JEdNW+sMc4Gwg1CinYeWBq3J/3tqGft0YyCX8CpNPtos+P4+P6HEuvd/KP2VaRq2CtUsi1kPjc4gRwFdf+o003vXcuWHzLLy72xOq9QiUP/zi6jgcaniqZ6psjNZssk5DWWYW22dhpstH13+7SNtkVB0Mam5v7wi3UKL8ujU25nkyzg5anlmc5c5VLoqYa+oDvtWtlnynrDUAdQdQF9YtPpXNRvEvVUeXJpB2MRh4sQmsxoRKMV7QcH5Qkyq4E+tKqfd3jYvxVvzml13yKshramcB62Jc+LI5h+EKybnabTAxvZyJSkIWIpFH5hH9 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a30b84dd-c04c-4236-7edb-08dcc8e02852 X-MS-Exchange-CrossTenant-AuthSource: KL1PR0601MB4113.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2024 10:40:25.5937 (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: GzEeL2lPVx7KpGUs8o4eMs7jEBG42Jg8GthhKi4SnEa+ghbzSWETDeu7FtPC9BB6NCfqBfgG04VMSqFsFqyqGg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB6667 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240830_034044_817080_E7877495 X-CRM114-Status: GOOD ( 12.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org dev_err_probe() is used to log an error message during the probe process of a device. It can 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: Yan Zhen --- drivers/thermal/broadcom/brcmstb_thermal.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c index 9674e5ffcfa2..270982740fde 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -338,11 +338,9 @@ static int brcmstb_thermal_probe(struct platform_device *pdev) thermal = devm_thermal_of_zone_register(&pdev->dev, 0, priv, of_ops); - if (IS_ERR(thermal)) { - ret = PTR_ERR(thermal); - dev_err(&pdev->dev, "could not register sensor: %d\n", ret); - return ret; - } + if (IS_ERR(thermal)) + return dev_err_probe(&pdev->dev, PTR_ERR(thermal), + "could not register sensor\n"); priv->thermal = thermal; @@ -352,10 +350,9 @@ static int brcmstb_thermal_probe(struct platform_device *pdev) brcmstb_tmon_irq_thread, IRQF_ONESHOT, DRV_NAME, priv); - if (ret < 0) { - dev_err(&pdev->dev, "could not request IRQ: %d\n", ret); - return ret; - } + if (ret < 0) + return dev_err_probe(&pdev->dev, ret, + "could not request IRQ\n"); } dev_info(&pdev->dev, "registered AVS TMON of-sensor driver\n");