Skip to content

Commit 93d08a1

Browse files
kpoosarodrigovivi
authored andcommitted
drm/xe/hwmon: Prevent unintended VRAM channel creation
Remove the unnecessary VRAM channel entry introduced in xe_hwmon_channel. Without this, adding any new hwmon channel causes extra VRAM channel to appear. This remained unnoticed earlier because VRAM was the final xe hwmon channel. v2: Use MAX_VRAM_CHANNELS with in_range() instead of CHANNEL_VRAM_N_MAX. (Raag) Fixes: 49a4983 ("drm/xe/hwmon: Expose individual VRAM channel temperature") Signed-off-by: Karthik Poosa <karthik.poosa@intel.com> Reviewed-by: Raag Jadav <raag.jadav@intel.com> Link: https://patch.msgid.link/20260206081655.2115439-1-karthik.poosa@intel.com Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> (cherry picked from commit 48eb073) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
1 parent b61d565 commit 93d08a1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/gpu/drm/xe/xe_hwmon.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ enum xe_hwmon_channel {
4848
CHANNEL_MCTRL,
4949
CHANNEL_PCIE,
5050
CHANNEL_VRAM_N,
51-
CHANNEL_VRAM_N_MAX = CHANNEL_VRAM_N + MAX_VRAM_CHANNELS,
51+
CHANNEL_VRAM_N_MAX = CHANNEL_VRAM_N + MAX_VRAM_CHANNELS - 1,
5252
CHANNEL_MAX,
5353
};
5454

@@ -264,7 +264,7 @@ static struct xe_reg xe_hwmon_get_reg(struct xe_hwmon *hwmon, enum xe_hwmon_reg
264264
return BMG_PACKAGE_TEMPERATURE;
265265
else if (channel == CHANNEL_VRAM)
266266
return BMG_VRAM_TEMPERATURE;
267-
else if (in_range(channel, CHANNEL_VRAM_N, CHANNEL_VRAM_N_MAX))
267+
else if (in_range(channel, CHANNEL_VRAM_N, MAX_VRAM_CHANNELS))
268268
return BMG_VRAM_TEMPERATURE_N(channel - CHANNEL_VRAM_N);
269269
} else if (xe->info.platform == XE_DG2) {
270270
if (channel == CHANNEL_PKG)
@@ -1427,7 +1427,7 @@ static int xe_hwmon_read_label(struct device *dev,
14271427
*str = "mctrl";
14281428
else if (channel == CHANNEL_PCIE)
14291429
*str = "pcie";
1430-
else if (in_range(channel, CHANNEL_VRAM_N, CHANNEL_VRAM_N_MAX))
1430+
else if (in_range(channel, CHANNEL_VRAM_N, MAX_VRAM_CHANNELS))
14311431
*str = hwmon->temp.vram_label[channel - CHANNEL_VRAM_N];
14321432
return 0;
14331433
case hwmon_power:

0 commit comments

Comments
 (0)