* [bug report] drm/xe/hwmon: expose fan speed
@ 2025-06-05 6:19 Dan Carpenter
2025-06-05 7:32 ` Raag Jadav
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-06-05 6:19 UTC (permalink / raw)
To: Raag Jadav; +Cc: intel-xe
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.
95
96 lockdep_assert_held(&tile->pcode.lock);
97
98 return __pcode_mailbox_rw(tile, mbox, data0, data1, timeout_ms, return_data, atomic);
99 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [bug report] drm/xe/hwmon: expose fan speed
2025-06-05 6:19 [bug report] drm/xe/hwmon: expose fan speed Dan Carpenter
@ 2025-06-05 7:32 ` Raag Jadav
0 siblings, 0 replies; 2+ messages in thread
From: Raag Jadav @ 2025-06-05 7:32 UTC (permalink / raw)
To: Dan Carpenter; +Cc: intel-xe
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-05 7:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-05 6:19 [bug report] drm/xe/hwmon: expose fan speed Dan Carpenter
2025-06-05 7:32 ` Raag Jadav
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox