[Freedreno] [bug report] drm/msm/a6xx: Send ACD state to QMP at GMU resume
Dan Carpenter
dan.carpenter at linaro.org
Thu Oct 12 09:10:51 UTC 2023
Hello Konrad Dybcio,
The patch 88a0997f2f94: "drm/msm/a6xx: Send ACD state to QMP at GMU
resume" from Sep 25, 2023 (linux-next), leads to the following Smatch
static checker warning:
drivers/gpu/drm/msm/adreno/a6xx_gmu.c:1813 a6xx_gmu_init()
warn: ignoring unreachable code.
drivers/gpu/drm/msm/adreno/a6xx_gmu.c
1774 gmu->cxpd = dev_pm_domain_attach_by_name(gmu->dev, "cx");
1775 if (IS_ERR(gmu->cxpd)) {
1776 ret = PTR_ERR(gmu->cxpd);
1777 goto err_mmio;
1778 }
1779
1780 if (!device_link_add(gmu->dev, gmu->cxpd,
1781 DL_FLAG_PM_RUNTIME)) {
1782 ret = -ENODEV;
1783 goto detach_cxpd;
1784 }
1785
1786 gmu->qmp = qmp_get(gmu->dev);
1787 if (IS_ERR(gmu->qmp) && adreno_is_a7xx(adreno_gpu))
1788 return PTR_ERR(gmu->qmp);
This should be a goto something_undo_device_link_add;
1789
1790 init_completion(&gmu->pd_gate);
1791 complete_all(&gmu->pd_gate);
1792 gmu->pd_nb.notifier_call = cxpd_notifier_cb;
1793
1794 /*
1795 * Get a link to the GX power domain to reset the GPU in case of GMU
1796 * crash
1797 */
1798 gmu->gxpd = dev_pm_domain_attach_by_name(gmu->dev, "gx");
1799
1800 /* Get the power levels for the GMU and GPU */
1801 a6xx_gmu_pwrlevels_probe(gmu);
1802
1803 /* Set up the HFI queues */
1804 a6xx_hfi_init(gmu);
1805
1806 /* Initialize RPMh */
1807 a6xx_gmu_rpmh_init(gmu);
1808
1809 gmu->initialized = true;
1810
1811 return 0;
1812
--> 1813 if (!IS_ERR_OR_NULL(gmu->qmp))
1814 qmp_put(gmu->qmp);
Unreachable. But we don't need to undo the qmp_get() in this funciton
because that's the last failure path. Do we need to add a qmp_put() to
a6xx_gmu_remove()? At first glance that looks like the undo function
for a6xx_gmu_init().
1815
1816 detach_cxpd:
1817 dev_pm_domain_detach(gmu->cxpd, false);
1818
1819 err_mmio:
1820 iounmap(gmu->mmio);
1821 if (platform_get_resource_byname(pdev, IORESOURCE_MEM, "rscc"))
1822 iounmap(gmu->rscc);
1823 free_irq(gmu->gmu_irq, gmu);
1824 free_irq(gmu->hfi_irq, gmu);
1825
1826 err_memory:
1827 a6xx_gmu_memory_free(gmu);
1828 err_put_device:
1829 /* Drop reference taken in of_find_device_by_node */
1830 put_device(gmu->dev);
1831
1832 return ret;
1833 }
regards,
dan carpenter
More information about the Freedreno
mailing list