All of lore.kernel.org
 help / color / mirror / Atom feed
* [Resend][PATCH] drivers/thermal: cleanup coding style a bit
@ 2020-11-10  8:10 Bernard
  2020-11-12 11:15 ` Daniel Lezcano
  0 siblings, 1 reply; 2+ messages in thread
From: Bernard @ 2020-11-10  8:10 UTC (permalink / raw)
  To: Zhang Rui, Daniel Lezcano, Amit Kucheria, linux-pm, linux-kernel
  Cc: opensource.kernel, Bernard Zhao

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 <bernard@vivo.com>
---
 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;
 }
-- 
2.29.0




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Resend][PATCH] drivers/thermal: cleanup coding style a bit
  2020-11-10  8:10 [Resend][PATCH] drivers/thermal: cleanup coding style a bit Bernard
@ 2020-11-12 11:15 ` Daniel Lezcano
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Lezcano @ 2020-11-12 11:15 UTC (permalink / raw)
  To: Bernard, Zhang Rui, Amit Kucheria, linux-pm, linux-kernel
  Cc: opensource.kernel

On 10/11/2020 09:10, Bernard wrote:
> 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 <bernard@vivo.com>
> ---

Applied, thanks



-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-12 11:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10  8:10 [Resend][PATCH] drivers/thermal: cleanup coding style a bit Bernard
2020-11-12 11:15 ` Daniel Lezcano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.