Commit c395c83a authored by Thierry Reding's avatar Thierry Reding Committed by Thomas Zimmermann

drm/simpledrm: Fix power domain device link validity check

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

Fixes: 61df9ca2 ("drm/simpledrm: Add support for multiple "power-domains"")
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Cc: Janne Grunau <j@jannau.net>
Cc: Eric Curtin <ecurtin@redhat.com>
Cc: Neal Gompa <neal@gompa.dev>
Cc: Sven Peter <sven@svenpeter.dev>
Cc: Javier Martinez Canillas <javierm@redhat.com>
Cc: dri-devel@lists.freedesktop.org
Link: https://patchwork.freedesktop.org/patch/msgid/20231011143230.1107731-1-thierry.reding@gmail.com
parent b9f29205
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment