Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Raag Jadav <raag.jadav@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: [bug report] drm/xe/hwmon: expose fan speed
Date: Thu, 5 Jun 2025 09:19:55 +0300	[thread overview]
Message-ID: <aEE3C2DpYkmbTPMA@stanley.mountain> (raw)

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

             reply	other threads:[~2025-06-05  6:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-05  6:19 Dan Carpenter [this message]
2025-06-05  7:32 ` [bug report] drm/xe/hwmon: expose fan speed Raag Jadav

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=aEE3C2DpYkmbTPMA@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=raag.jadav@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