Skip to contentSkip to conversation

drm/amd/pm: Modify mode2 msg sequence on aldebaran

bug report Dan Carpenter 1 participant 1 message Apr 13

lore
Share & tools
lore
#0 lore 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