public inbox for amd-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Lijo Lazar <lijo.lazar@amd.com>
Cc: amd-gfx@lists.freedesktop.org, "SHANMUGAM,
	SRINIVASAN" <SRINIVASAN.SHANMUGAM@amd.com>
Subject: [bug report] drm/amd/pm: Modify mode2 msg sequence on aldebaran
Date: Mon, 13 Apr 2026 11:38:44 +0300	[thread overview]
Message-ID: <adyrlBPbpWHAvn_w@stanley.mountain> (raw)

Hello Lijo Lazar,

Commit e42569d02acb ("drm/amd/pm: Modify mode2 msg sequence on
aldebaran") from Mar 16, 2021 (linux-next), leads to the following
Smatch static checker warning:

	drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/aldebaran_ppt.c:1861 aldebaran_mode2_reset()
	warn: missing error code here? '_dev_err()' failed. 'ret' = '0'

drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/aldebaran_ppt.c
    1827 static int aldebaran_mode2_reset(struct smu_context *smu)
    1828 {
    1829         struct smu_msg_ctl *ctl = &smu->msg_ctl;
    1830         struct amdgpu_device *adev = smu->adev;
    1831         int ret = 0;
    1832         int timeout = 10;
    1833 
    1834         mutex_lock(&ctl->lock);
    1835 
    1836         if (smu->smc_fw_version >= 0x00441400) {
    1837                 ret = smu_msg_send_async_locked(ctl, SMU_MSG_GfxDeviceDriverReset,
    1838                                                 SMU_RESET_MODE_2);
    1839                 if (ret)
    1840                         goto out;
    1841 
    1842                 /* This is similar to FLR, wait till max FLR timeout */
    1843                 msleep(100);
    1844                 dev_dbg(adev->dev, "restore config space...\n");
    1845                 /* Restore the config space saved during init */
    1846                 amdgpu_device_load_pci_state(adev->pdev);
    1847 
    1848                 dev_dbg(adev->dev, "wait for reset ack\n");
    1849                 while (ret == -ETIME && timeout)  {
    1850                         ret = smu_msg_wait_response(ctl, 0);
    1851                         /* Wait a bit more time for getting ACK */
    1852                         if (ret == -ETIME) {
    1853                                 --timeout;
    1854                                 usleep_range(500, 1000);
    1855                                 continue;
    1856                         }
    1857 
    1858                         if (ret != 1) {
    1859                                 dev_err(adev->dev, "failed to send mode2 message \tparam: 0x%08x response %#x\n",
    1860                                                 SMU_RESET_MODE_2, ret);
--> 1861                                 goto out;

Do we need to set an error code on this goto?  aldebaran_mode2_reset()
doesn't have a comment describing the returns...

    1862                         }
    1863                 }
    1864 
    1865         } else {
    1866                 dev_err(adev->dev, "smu fw 0x%x does not support MSG_GfxDeviceDriverReset MSG\n",
    1867                                 smu->smc_fw_version);
    1868         }
    1869 
    1870         if (ret == 1)
    1871                 ret = 0;
    1872 out:
    1873         mutex_unlock(&ctl->lock);
    1874 
    1875         return ret;
    1876 }

This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter

                 reply	other threads:[~2026-04-13 12:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=adyrlBPbpWHAvn_w@stanley.mountain \
    --to=error27@gmail.com \
    --cc=SRINIVASAN.SHANMUGAM@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=lijo.lazar@amd.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