[bug report] accel/amdxdna: Enhance power management settings

Dan Carpenter dan.carpenter at linaro.org
Wed Jan 8 08:40:46 UTC 2025


Hello Lizhi Hou,

Commit f4d7b8a6bc8c ("accel/amdxdna: Enhance power management
settings") from Dec 13, 2024 (linux-next), leads to the following
Smatch static checker warning:

	drivers/accel/amdxdna/aie2_smu.c:68 npu1_set_dpm()
	error: uninitialized symbol 'freq'.

drivers/accel/amdxdna/aie2_smu.c
    57 int npu1_set_dpm(struct amdxdna_dev_hdl *ndev, u32 dpm_level)
    58 {
    59         u32 freq;
    60         int ret;
    61 
    62         ret = aie2_smu_exec(ndev, AIE2_SMU_SET_MPNPUCLK_FREQ,
    63                             ndev->priv->dpm_clk_tbl[dpm_level].npuclk, &freq);
    64         if (ret) {
    65                 XDNA_ERR(ndev->xdna, "Set npu clock to %d failed, ret %d\n",
    66                          ndev->priv->dpm_clk_tbl[dpm_level].npuclk, ret);

return ret; ?

    67         }
--> 68         ndev->npuclk_freq = freq;
    69 
    70         ret = aie2_smu_exec(ndev, AIE2_SMU_SET_HCLK_FREQ,
    71                             ndev->priv->dpm_clk_tbl[dpm_level].hclk, &freq);
    72         if (ret) {
    73                 XDNA_ERR(ndev->xdna, "Set h clock to %d failed, ret %d\n",
    74                          ndev->priv->dpm_clk_tbl[dpm_level].hclk, ret);

Here too?

    75         }
    76         ndev->hclk_freq = freq;
    77         ndev->dpm_level = dpm_level;
    78 
    79         XDNA_DBG(ndev->xdna, "MP-NPU clock %d, H clock %d\n",
    80                  ndev->npuclk_freq, ndev->hclk_freq);
    81 
    82         return 0;
    83 }

regards,
dan carpenter


More information about the dri-devel mailing list