* [PATCH] powercap: intel_rapl: remove redundant store to value after multiply
@ 2022-05-18 8:45 Colin Ian King
2022-05-19 17:49 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2022-05-18 8:45 UTC (permalink / raw)
To: Rafael J . Wysocki, linux-pm; +Cc: kernel-janitors, linux-kernel
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]
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
drivers/powercap/intel_rapl_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c
index 83da499dd6ec..70e38278986d 100644
--- a/drivers/powercap/intel_rapl_common.c
+++ b/drivers/powercap/intel_rapl_common.c
@@ -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);
--
2.36.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] powercap: intel_rapl: remove redundant store to value after multiply
2022-05-18 8:45 [PATCH] powercap: intel_rapl: remove redundant store to value after multiply Colin Ian King
@ 2022-05-19 17:49 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2022-05-19 17:49 UTC (permalink / raw)
To: Colin Ian King
Cc: Rafael J . Wysocki, Linux PM, kernel-janitors, Linux Kernel Mailing List
On Wed, May 18, 2022 at 10:45 AM Colin Ian King <colin.i.king@gmail.com> wrote:
>
> 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]
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
> drivers/powercap/intel_rapl_common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c
> index 83da499dd6ec..70e38278986d 100644
> --- a/drivers/powercap/intel_rapl_common.c
> +++ b/drivers/powercap/intel_rapl_common.c
> @@ -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!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-19 17:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-18 8:45 [PATCH] powercap: intel_rapl: remove redundant store to value after multiply Colin Ian King
2022-05-19 17:49 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®