From patchwork Tue Nov 10 08:10:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernard Zhao X-Patchwork-Id: 11893489 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DC29D1668 for ; Tue, 10 Nov 2020 08:10:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C5870208FE for ; Tue, 10 Nov 2020 08:10:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729610AbgKJIK4 (ORCPT ); Tue, 10 Nov 2020 03:10:56 -0500 Received: from m176150.mail.qiye.163.com ([59.111.176.150]:57082 "EHLO m176150.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726467AbgKJIKz (ORCPT ); Tue, 10 Nov 2020 03:10:55 -0500 Received: from vivo.com (wm-10.qy.internal [127.0.0.1]) by m176150.mail.qiye.163.com (Hmail) with ESMTP id A68B91A3B62; Tue, 10 Nov 2020 16:10:20 +0800 (CST) Message-ID: To: Zhang Rui , Daniel Lezcano , Amit Kucheria , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Bernard Zhao Subject: =?utf-8?q?=5BResend=5D=5BPATCH=5D_drivers/thermal=3A_cleanup_coding?= =?utf-8?q?_style_a_bit?= X-Priority: 3 X-Mailer: HMail Webmail Server V2.0 Copyright (c) 2016-163.com X-Originating-IP: 58.213.83.157 MIME-Version: 1.0 Received: from bernard@vivo.com( [58.213.83.157) ] by ajax-webmail ( [127.0.0.1] ) ; Tue, 10 Nov 2020 16:10:20 +0800 (GMT+08:00) From: Bernard Date: Tue, 10 Nov 2020 16:10:20 +0800 (GMT+08:00) X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZS1VLWVdZKFlBSE83V1ktWUFJV1kPCR oVCBIfWUFZGh0dTRlNTBlCS0JMVkpNS09CQk5DSUtMTUtVEwETFhoSFyQUDg9ZV1kWGg8SFR0UWU FZT0tIVUpKS0hKQ1VLWQY+ X-HM-Sender-Digest: e1kMHhlZQQ8JDh5XWRIfHhUPWUFZRzorFDpOHDhPPy1KEUweEjIeNw0* DAoKElVKVUpNS09CQk5DSUpKSUNVMxYaEhdVGR4JFRoJHzsNEg0UVRgUFkVZV1kSC1lBWU5DVUlK SFVDSFVKTkxZV1kIAVlBSU5JTzcG X-HM-Tid: 0a75b134ac9a93b4kuwsa68b91a3b62 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Function thermal_add_hwmon_sysfs, hwmon will be NULL when new_hwmon_device = 0, so there is no need to check, kfree will handle NULL point. Signed-off-by: Bernard Zhao --- drivers/thermal/thermal_hwmon.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c index 8b92e00ff236..ad03262cca56 100644 --- a/drivers/thermal/thermal_hwmon.c +++ b/drivers/thermal/thermal_hwmon.c @@ -206,8 +206,7 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) if (new_hwmon_device) hwmon_device_unregister(hwmon->device); free_mem: - if (new_hwmon_device) - kfree(hwmon); + kfree(hwmon); return result; }