Thermal:Remove usless if(!result) before return tz
PATCH 2/2 Thermal:Remove usless if(!result) before return tz
result is always zero when comes here.
--- drivers/thermal/thermal_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/thermal/thermal_core.c +1 -2
@@ -1568,8 +1568,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type,thermal_zone_device_update (tz); -if (!result) -return tz; +return tz; unregister:release_idr (&thermal_tz_idr, &thermal_idr_lock, tz->id);
--
1.8.0.1
Hello Yao
Quoted 13 lines · Yao Dongdong
result is always zero when comes here.
Signed-off-by [email protected]--- drivers/thermal/thermal_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/thermal/thermal_core.c +0
-0
drivers/thermal/thermal_core.c struct thermal_zone_device *thermal_zone_device_register(const char *type, · line 1572
Quoted 7 lines
drivers/thermal/thermal_core.c +1
-2@@ -1568,8 +1568,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type,thermal_zone_device_update (tz); -if (!result) -return tz; +return tz;
Adding a return here will make the resource release below not reachable in the fail path.
Quoted 6 lines
drivers/thermal/thermal_core.c +0
-1unregister:release_idr (&thermal_tz_idr, &thermal_idr_lock, tz->id); --1.8.0.1
Quoted 17 lines · Eduardo Valentin
Hello Yao
Quoted 14 lines · Yao Dongdong
result is always zero when comes here.
Signed-off-by [email protected]--- drivers/thermal/thermal_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/thermal/thermal_core.c +0
-0@@ -1568,8 +1568,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type,
Quoted 8 lines
drivers/thermal/thermal_core.c struct thermal_zone_device *thermal_zone_device_register(const char *type, · line 1572
Quoted 6 lines
drivers/thermal/thermal_core.c +1
-2thermal_zone_device_update (tz); -if (!result) -return tz; +return tz;Adding a return here will make the resource release below not reachable in the fail path.
But all fails above followed a "goto unregister", so i think it must be successful when come here.
Thanks.
Quoted 6 lines
Quoted 6 lines
drivers/thermal/thermal_core.c +0
-1unregister:release_idr (&thermal_tz_idr, &thermal_idr_lock, tz->id); --1.8.0.1
Eduardo Valentin
Acked-byHello Yao,
Quoted 21 lines · Yao Dongdong
Quoted 19 lines · Eduardo Valentin
Hello Yao
Quoted 16 lines · Yao Dongdong
result is always zero when comes here.
Signed-off-by [email protected]--- drivers/thermal/thermal_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/thermal/thermal_core.c +0
-0@@ -1568,8 +1568,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type,thermal_zone_device_update (tz);
Quoted 8 lines
Quoted 6 lines
drivers/thermal/thermal_core.c struct thermal_zone_device *thermal_zone_device_register(const char *type, · line 1572
Quoted 4 lines
drivers/thermal/thermal_core.c +1
-2-if (!result) -return tz; +return tz;Adding a return here will make the resource release below not reachable in the fail path.
But all fails above followed a "goto unregister", so i think it must be successful when come here.
Yes, I see your point. Agreed.
Quoted 11 lines
Thanks.
Quoted 6 lines
Quoted 6 lines
drivers/thermal/thermal_core.c +0
-1unregister:release_idr (&thermal_tz_idr, &thermal_idr_lock, tz->id); --1.8.0.1