[bug report] drm/xe/hwmon: expose fan speed

Raag Jadav raag.jadav at intel.com
Thu Jun 5 07:32:50 UTC 2025


On Thu, Jun 05, 2025 at 09:19:55AM +0300, Dan Carpenter wrote:
> Hello Raag Jadav,
> 
> Commit 28f79ac609de ("drm/xe/hwmon: expose fan speed") from Mar 12,
> 2025 (linux-next), leads to the following Smatch static checker
> warning:
> 
> 	drivers/gpu/drm/xe/xe_hwmon.c:1008 xe_hwmon_fan_is_visible()
> 	error: uninitialized symbol 'uval'.
> 
> drivers/gpu/drm/xe/xe_hwmon.c
>     995 static umode_t
>     996 xe_hwmon_fan_is_visible(struct xe_hwmon *hwmon, u32 attr, int channel)
>     997 {
>     998         u32 uval;
>     999 
>     1000         if (!hwmon->xe->info.has_fan_control)
>     1001                 return 0;
>     1002 
>     1003         switch (attr) {
>     1004         case hwmon_fan_input:
>     1005                 if (xe_hwmon_pcode_read_fan_control(hwmon, FSC_READ_NUM_FANS, &uval))
>     1006                         return 0;
>     1007 
> --> 1008                 return channel < uval ? 0444 : 0;
>     1009         default:
>     1010                 return 0;
>     1011         }
>     1012 }
> 
> The problem is in pcode_mailbox_rw() where we return success without
> writing to *uval.
> 
>     89  static int pcode_mailbox_rw(struct xe_tile *tile, u32 mbox, u32 *data0, u32 *data1,
>     90                              unsigned int timeout_ms, bool return_data,
>     91                              bool atomic)
>     92  {
>     93          if (tile_to_xe(tile)->info.skip_pcode)
>     94                  return 0;
>                         ^^^^^^^^^
> data0 is *uval.

Thanks for the report. IIUC xe->info.skip_pcode is set for IS_SRIOV_VF(xe)
cases and we don't register hwmon interface in that case.

Raag


More information about the Intel-xe mailing list