From patchwork Tue Jun 13 11:24:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13278556 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 6CE0AC77B7A for ; Tue, 13 Jun 2023 11:25:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=YsTAyXZdSA9dQY77e+TyJav9nbVT0i0q+65QQC5ILag=; b=aWNtYt2WNURswQ pd95Y+21CjBGJn38/BNzTI5Muc1J3XsUFLuKelCVd99dbqll/5ZkRPlojehN9LL+G/c88aZ9yytnw 3Fwgprb7ZLR0pbJWbBm+htA/1SQJPhdg+5gyTtquDt6EGf/I4YTPgsbVCyIH+a5Ajr67KU8L4L3I+ UFH3b6rXJWi1e0u0n4Q5BQP3Q8WadAG0ANv76r5FPAwzMdP8LZpCGAWkdmdJkA2aP/VXHLagi9gPD tgg32RdKiNIvVU2H/ssxioeHySbs3AdZd0C118Ab/jqzvA/plY1FSz1afyNfexewRm0pKQuCSCnn+ atVPYU+TRCzXADLRe5EA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q929M-007tkE-1b; Tue, 13 Jun 2023 11:25:24 +0000 Received: from mail-tyzapc01on20721.outbound.protection.outlook.com ([2a01:111:f403:704b::721] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q929I-007tj3-0u; Tue, 13 Jun 2023 11:25:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VICfmkJo++DKzQ6n6BT3qmKVzvdz5tDb+eS3m8J5OZsDlbK6njxLaOyb7vCSvuwE/j1Qc6qdfYsqHmMK9NfaHvOk9ywk43gpsmr2t6BBSJhXxasq27GAGO7zZQ10DSQsxfX41zUS1nT5tv4N3L1Zzs1fNF3mmQhkwkNGi44tu1+MGC7lGBy5CY8Usyc0A3pzuC7K/YnDdTZt+UH/A77YjwDUAHUMcSp9EFZyNYIa3PjPbvz9sEwApxq6isMXhUxvz8HeHCJtVu1xTEi8i6euxzTW5MRmkTN5pt/Fge1+fQhudeu/kV8llZpvWSmL+Cewn3854rw+wQBiEke22IqRFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=rdh5vOmUeNsam3N24Vb/ae/KnRPNs/UXo0w5JAbpOlA=; b=bIjjDc0sLa8z2dCi4Tvtt2+a1mCeXy13AthKWDNqSlDWK8jGydoQ9O3Tw1czN+iq+LAkRptS6dAGLB9TREbUQDUIOvm3qzPjDG+8+/90p0Bz5xgUaHabv5zVUsCL2uZsCGutjNBM2gCVF23csBIUQ0VfO1PLOSkTcUqwjTtGi+1Pq1Rxh4JboR6/8iBYR/CoTZN3BIceFquuQM3Dxn4Bn78+tAKmOEqiO4gvlNM5Idq9Hc5c+lHIzq7k+/J/Vdd/NcGP23S0ggA14p8k2/sTCq6g3RAnxGky2ISv9PpDIB/JB6qND+dgEe+GICd05iEndjd9d+RhiArF8AQJdr1XmQ== 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=rdh5vOmUeNsam3N24Vb/ae/KnRPNs/UXo0w5JAbpOlA=; b=PFkg8UwcWkAIzCgTNgGHOVFjEgGqrFwz51JtsZ1+OVfmf3xF1TwxreWkowIkVzvJ1Gdu2Es0mRG23IkpzIeNXSShvKNBvJ5yYdDsDj7KCbuiQMMZykzxMupcyn5zRcYvcYk2IegW+NRGZywH0a+1Zuhw92VG2duhsWpPB2enPKqsFPPnLnH13K9vb6wDfKgMJMmk30YZIeqjvq3Ux9AnU63tCwaCMsgTuA674ZzG1mRI5jp2rrm0FwCaLzUKDPproe5y3EPTSw6njQtBsgCe8zYbEzUDr8sRf4s7V6fs66ZAPhmIalnuM3oKPpZDAbgmD3oO7tTHszOhB5j8pKoJmw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by SEZPR06MB5920.apcprd06.prod.outlook.com (2603:1096:101:f0::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 13 Jun 2023 11:25:05 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::76d6:4828:7e80:2965]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::76d6:4828:7e80:2965%3]) with mapi id 15.20.6455.039; Tue, 13 Jun 2023 11:25:05 +0000 From: Yangtao Li To: glaroque@baylibre.com, rafael@kernel.org, daniel.lezcano@linaro.org, amitk@kernel.org, rui.zhang@intel.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, thara.gopinath@gmail.com, anarsoul@gmail.com, tiny.windzz@gmail.com, wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org, thierry.reding@gmail.com, jonathanh@nvidia.com, edubezval@gmail.com, j-keerthy@ti.com, f.fainelli@gmail.com Cc: linux-pm@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-omap@vger.kernel.org, Yangtao Li Subject: [PATCH v2 01/11] thermal/hwmon: Add error information printing for devm_thermal_add_hwmon_sysfs() Date: Tue, 13 Jun 2023 19:24:34 +0800 Message-Id: <20230613112444.48042-1-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 X-ClientProxiedBy: SG2PR04CA0159.apcprd04.prod.outlook.com (2603:1096:4::21) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SEZPR06MB5920:EE_ X-MS-Office365-Filtering-Correlation-Id: 40e17ee7-8bf2-4478-54ce-08db6c00d5da X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9wGME2FKpnULZJq+12pK6X+LK/p3rpDwE5SdkgiDxWepxFphwBX1yitOD9QIhIO4VpaYdgviMQaze6N9JNHpnlaCXll5krc27VV5WwOnTLFwA3krpoyw55HClhkIEeDsESqeji4o8cF74s062xNEcfJxZZ7V+vDKHgb2s8qSRUCZ+L1rY5Meh/STGSY30SMMuNCDDea0rLzaQugnHbgYdaFspWrzX9DTExpy0JYTeTSOG4ZejDppD1XQ+Zby9RzhsJ9sVgPXpAdzBCPn7JmoO8v2dLnX3rgPet3+YhNwEKIlfIgUpEC9cyT/iyEQst8jSCE85hhv+W7GhxDIm9tqmcI+9P7faxmJwcKd3HnJbRSXh8XBwyHITFNFmvR94CYQE0Drr55n+AbBr3myefn0FSXUNo3mchZKGqnXFNqfLDbXyPa3msQ8A+CrUKCYzQOA8M78JgVueys81xIlrWJcduQrgVjFdoFWZhcvOuXvCGXdw0t2VcuTrf8ZBmLDqpvbz2KjtkwNqjSLNlcALkR9yURptSRyugFgtF+3xZqXA5IhNI4BFfSPfRsEGlnrjbYjNi//gvSDm3afGV+D+aDSd8/eHNYqKPLpwsXk4VZg+kUB4Op746Orvtm/Dq8hKSnxJ0itpZh52MtHqrqhTYm8LA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(366004)(396003)(136003)(39860400002)(346002)(451199021)(66476007)(38100700002)(66556008)(66946007)(921005)(2616005)(6512007)(26005)(6486002)(6506007)(478600001)(52116002)(6666004)(36756003)(107886003)(86362001)(316002)(1076003)(4326008)(38350700002)(186003)(5660300002)(8936002)(2906002)(7416002)(7406005)(83380400001)(8676002)(41300700001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HUUwZWnnDUXr8cGVK8Xj9uZwmJdF39/oEsnAQWvYP7ZJwzDQqUr3jYVogWC32kNrEa1cpQ58k1jBWG5p9c1RahzEcaNBVcIpDZ5hp0CM7r0JRlJkJ3B0UdGkeT6sCGst+InIWtsLZpvSHOm1uVUP2ntespWMz/dY+vhN3r3F0yea2X8pYTbYMw+QtHMGdk4wGlt7LSKEuMlrpTRWdFeX6Dy+dAea0j/rK3FidgLb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OHREtgz+apG9Kwzh0HkCbQuv3X9rPpjSMX48AcoLbjxXilZka4JbwnruNP5O1QKi6ktiY6Fv28CBsP9p/D2Y2ZSq/uCQQ5H+onkSKiREcJURRyMtN6dk5BnROWiCRFev69jEGC4WhGgZli2piNwUyVCg1s3iKgunaaBnschPsVuwVT9NEAD9B9gRX+rY8PSGUyLtrpOaXDlGYJTTKEBk6Zu0Q9iihmSI/IfS6r2mD/Pg+mR0+Vz12U2aiWqQt7wu+poN4yELNw+knNcudZxcJZfRWuXNh2/KQRZTboDwWm X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 40e17ee7-8bf2-4478-54ce-08db6c00d5da X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2023 11:25:04.9478 (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: /wXoQaLmCv4dvz9uq9/fnEXhtHg04aIys8P5LEDG+yeCAKE6YUIOu4zZNzFgJHgLo+6T6k0QQh/7G5H7FmuB9w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB5920 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230613_042520_596460_B86AACAE X-CRM114-Status: UNSURE ( 9.79 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Ensure that all error handling branches print error information. In this way, when this function fails, the upper-layer functions can directly return an error code without missing debugging information. Otherwise, the error message will be printed redundantly or missing. Signed-off-by: Yangtao Li --- v2: -convert to dev_warn drivers/thermal/thermal_hwmon.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c index fbe55509e307..c3ae44659b81 100644 --- a/drivers/thermal/thermal_hwmon.c +++ b/drivers/thermal/thermal_hwmon.c @@ -271,11 +271,14 @@ int devm_thermal_add_hwmon_sysfs(struct device *dev, struct thermal_zone_device ptr = devres_alloc(devm_thermal_hwmon_release, sizeof(*ptr), GFP_KERNEL); - if (!ptr) + if (!ptr) { + dev_warn(dev, "Failed to allocate device resource data\n"); return -ENOMEM; + } ret = thermal_add_hwmon_sysfs(tz); if (ret) { + dev_warn(dev, "Failed to add hwmon sysfs attributes\n"); devres_free(ptr); return ret; }