Skip to contentSkip to conversation

powercap: intel_rapl: remove redundant store to value after multiply

PATCH Applied Colin Ian King 2 participants 2 messages May 18, 2022 – May 19, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powercap: intel_rapl: remove redundant store to value after multiply

There is no need to store the result of the multiply back to variable value after the multiplication. The store is redundant, replace *= with just *.

Cleans up clang scan build warning:
warning: Although the value stored to 'value' is used in the enclosing expression, the value is never actually read from 'value' [deadcode.DeadStores]

---
 drivers/powercap/intel_rapl_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/powercap/intel_rapl_common.c +1 -1
index 83da499dd6ec..70e38278986d 100644
@@ -1010,7 +1010,7 @@ static u64 rapl_compute_time_window_atom(struct rapl_package *rp, u64 value,
 	 * where time_unit is default to 1 sec. Never 0.
 	 */
 	if (!to_raw)
-		return (value) ? value *= rp->time_unit : rp->time_unit;
+		return (value) ? value * rp->time_unit : rp->time_unit;
 
 	value = div64_u64(value, rp->time_unit);
 
Signature · 1 line
2.36.1
maintainer Applied
#1 lore raw
Quoted 19 lines · Colin Ian King

There is no need to store the result of the multiply back to variable value after the multiplication. The store is redundant, replace *= with just *.

Cleans up clang scan build warning:
warning: Although the value stored to 'value' is used in the enclosing expression, the value is never actually read from 'value' [deadcode.DeadStores]

---
 drivers/powercap/intel_rapl_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/powercap/intel_rapl_common.c +0 -0
index 83da499dd6ec..70e38278986d 100644

drivers/powercap/intel_rapl_common.c static u64 rapl_compute_time_window_atom(struct rapl_package *rp, u64 value,

Quoted 9 lines
drivers/powercap/intel_rapl_common.c +1 -2
@@ -1010,7 +1010,7 @@ static u64 rapl_compute_time_window_atom(struct rapl_package *rp, u64 value,
         * where time_unit is default to 1 sec. Never 0.
         */
        if (!to_raw)
-               return (value) ? value *= rp->time_unit : rp->time_unit;
+               return (value) ? value * rp->time_unit : rp->time_unit;
 
        value = div64_u64(value, rp->time_unit);
 
--

Applied as 5.19 material, thanks!