[PATCH] drm/simpledrm: Fix power domain device link validity check

Thierry Reding thierry.reding at gmail.com
Wed Oct 11 14:32:30 UTC 2023


From: Thierry Reding <treding at nvidia.com>

We need to check if a link is non-NULL before trying to delete it.

Signed-off-by: Thierry Reding <treding at nvidia.com>
---
 drivers/gpu/drm/tiny/simpledrm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
index 9c597461d1e2..8bdaf66044fc 100644
--- a/drivers/gpu/drm/tiny/simpledrm.c
+++ b/drivers/gpu/drm/tiny/simpledrm.c
@@ -506,7 +506,7 @@ static void simpledrm_device_detach_genpd(void *res)
 		return;
 
 	for (i = sdev->pwr_dom_count - 1; i >= 0; i--) {
-		if (!sdev->pwr_dom_links[i])
+		if (sdev->pwr_dom_links[i])
 			device_link_del(sdev->pwr_dom_links[i]);
 		if (!IS_ERR_OR_NULL(sdev->pwr_dom_devs[i]))
 			dev_pm_domain_detach(sdev->pwr_dom_devs[i], true);
-- 
2.42.0



More information about the dri-devel mailing list