Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Karthik Poosa <karthik.poosa@intel.com>, intel-gfx@lists.freedesktop.org
Cc: Karthik Poosa <karthik.poosa@intel.com>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/hwmon: Fix static analysis tool errors in i915 hwmon
Date: Wed, 29 Nov 2023 12:23:55 +0200	[thread overview]
Message-ID: <87y1eg6eo4.fsf@intel.com> (raw)
In-Reply-To: <20231129102555.978644-1-karthik.poosa@intel.com>

On Wed, 29 Nov 2023, Karthik Poosa <karthik.poosa@intel.com> wrote:
> Updated i915 hwmon with fixes for issues reported by static analysis tool.

What's the problem? It's not enough to say this fixes a static analyzer
report. Tell us what the problem is, and why this is the fix.

BR,
Jani.


>
> Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_hwmon.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_hwmon.c b/drivers/gpu/drm/i915/i915_hwmon.c
> index 975da8e7f2a9..69bb49a684b6 100644
> --- a/drivers/gpu/drm/i915/i915_hwmon.c
> +++ b/drivers/gpu/drm/i915/i915_hwmon.c
> @@ -175,7 +175,7 @@ hwm_power1_max_interval_show(struct device *dev, struct device_attribute *attr,
>  	 *     tau4 = (4 | x) << y
>  	 * but add 2 when doing the final right shift to account for units
>  	 */
> -	tau4 = ((1 << x_w) | x) << y;
> +	tau4 = ((u64)(1 << x_w) | x) << y;
>  	/* val in hwmon interface units (millisec) */
>  	out = mul_u64_u32_shr(tau4, SF_TIME, hwmon->scl_shift_time + x_w);
>  
> @@ -211,7 +211,7 @@ hwm_power1_max_interval_store(struct device *dev,
>  	r = FIELD_PREP(PKG_MAX_WIN, PKG_MAX_WIN_DEFAULT);
>  	x = REG_FIELD_GET(PKG_MAX_WIN_X, r);
>  	y = REG_FIELD_GET(PKG_MAX_WIN_Y, r);
> -	tau4 = ((1 << x_w) | x) << y;
> +	tau4 = ((u64)(1 << x_w) | x) << y;
>  	max_win = mul_u64_u32_shr(tau4, SF_TIME, hwmon->scl_shift_time + x_w);
>  
>  	if (val > max_win)

-- 
Jani Nikula, Intel

  reply	other threads:[~2023-11-29 10:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-29 10:25 [Intel-gfx] [PATCH] drm/i915/hwmon: Fix static analysis tool errors in i915 hwmon Karthik Poosa
2023-11-29 10:23 ` Jani Nikula [this message]
2023-11-29 15:28 ` [Intel-gfx] ✗ Fi.CI.BUILD: warning for " Patchwork
2023-11-29 16:13 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-11-30 13:59 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2023-12-01  4:58 [Intel-gfx] [PATCH] " Karthik Poosa
2023-12-01 13:24 ` Gupta, Anshuman
2023-12-01 13:43 ` Nilawar, Badal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y1eg6eo4.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=karthik.poosa@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox