diff mbox series

drm/simpledrm: Fix power domain device link validity check

Message ID 20231011143230.1107731-1-thierry.reding@gmail.com (mailing list archive)
State New, archived
Headers show
Series drm/simpledrm: Fix power domain device link validity check | expand

Commit Message

Thierry Reding Oct. 11, 2023, 2:32 p.m. UTC
From: Thierry Reding <treding@nvidia.com>

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

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

Comments

Thomas Zimmermann Oct. 12, 2023, 8:36 a.m. UTC | #1
Hi

Am 11.10.23 um 16:32 schrieb Thierry Reding:
> From: Thierry Reding <treding@nvidia.com>
> 
> We need to check if a link is non-NULL before trying to delete it.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

I'm going to merge the patch into drm-misc-next with the additional 
Fixes tag

Fixes: 61df9ca23107 ("drm/simpledrm: Add support for multiple 
"power-domains"")

Best regards
Thomas


> ---
>   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);
diff mbox series

Patch

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);