Skip to contentSkip to conversation

drm: self_refresh: Fix a reversed condition in drm_self_refresh_helper_cleanup()

PATCH In review Dan Carpenter 3 participants 3 messages Jun 19, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: self_refresh: Fix a reversed condition in drm_self_refresh_helper_cleanup()

This test is flipped around so it either leads to a memory leak or a NULL dereference.

Fixes 1452c25b0e60 ("drm: Add helpers to kick off self refresh mode in drivers")

---
I'm not totally sure what the prefered patch prefix for this code. One thing that would help is when we're adding new files we should specify the prefix that they're going to use:

- drm: Add helpers to kick off self refresh mode in drivers
+ drm: refresh mode: Add helpers to kick off self refresh mode in drivers

It's a small thing and email always sounds whiny but I'm sending this suggestion to everyone today so...

 drivers/gpu/drm/drm_self_refresh_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_self_refresh_helper.c +1 -1
index 2b3daaf77841..e0d2ad1f070c 100644
@@ -205,7 +205,7 @@ void drm_self_refresh_helper_cleanup(struct drm_crtc *crtc)
 	struct drm_self_refresh_data *sr_data = crtc->self_refresh_data;
 
 	/* Helper is already uninitialized */
-	if (sr_data)
+	if (!sr_data)
 		return;
 
 	crtc->self_refresh_data = NULL;
Signature · 1 line
2.20.1
#1 lore raw
Quoted 5 lines · Dan Carpenter

This test is flipped around so it either leads to a memory leak or a NULL dereference.

Fixes 1452c25b0e60 ("drm: Add helpers to kick off self refresh mode in drivers")

Thanks for the patch and your bug report! I've applied this to -misc-next and will dig into the bug report shortly.

Quoted 10 lines

---
I'm not totally sure what the prefered patch prefix for this code. One thing that would help is when we're adding new files we should specify the prefix that they're going to use:

- drm: Add helpers to kick off self refresh mode in drivers
+ drm: refresh mode: Add helpers to kick off self refresh mode in drivers

It's a small thing and email always sounds whiny but I'm sending this suggestion to everyone today so...

There's no hard rule. For drivers we use drm/<driver>, and for core people use drm or drm/<file>.

Quoted 24 lines
 drivers/gpu/drm/drm_self_refresh_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_self_refresh_helper.c +1 -1
index 2b3daaf77841..e0d2ad1f070c 100644
@@ -205,7 +205,7 @@ void drm_self_refresh_helper_cleanup(struct drm_crtc *crtc)
 	struct drm_self_refresh_data *sr_data = crtc->self_refresh_data;
 
 	/* Helper is already uninitialized */
-	if (sr_data)
+	if (!sr_data)
 		return;
 
 	crtc->self_refresh_data = NULL;
Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
#2 lore raw
Quoted 15 lines · Sean Paul
Quoted 5 lines · Dan Carpenter

This test is flipped around so it either leads to a memory leak or a NULL dereference.

Fixes 1452c25b0e60 ("drm: Add helpers to kick off self refresh mode in drivers")

Thanks for the patch and your bug report! I've applied this to -misc-next and will dig into the bug report shortly.

Quoted 5 lines

---
I'm not totally sure what the prefered patch prefix for this code. One thing that would help is when we're adding new files we should specify the prefix that they're going to use:

Quoted 8 lines
Quoted 5 lines

- drm: Add helpers to kick off self refresh mode in drivers
+ drm: refresh mode: Add helpers to kick off self refresh mode in drivers

It's a small thing and email always sounds whiny but I'm sending this suggestion to everyone today so...

There's no hard rule. For drivers we use drm/<driver>, and for core people use drm or drm/<file>.

checkpatch.pl should have a git log popularity contest based check for the prefix. For new files, first come first served. ;)

BR,
Jani.

Quoted 25 lines
Quoted 25 lines

 drivers/gpu/drm/drm_self_refresh_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_self_refresh_helper.c +1 -1
index 2b3daaf77841..e0d2ad1f070c 100644
@@ -205,7 +205,7 @@ void drm_self_refresh_helper_cleanup(struct drm_crtc *crtc)
 	struct drm_self_refresh_data *sr_data = crtc->self_refresh_data;
 
 	/* Helper is already uninitialized */
-	if (sr_data)
+	if (!sr_data)
 		return;
 
 	crtc->self_refresh_data = NULL;
Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel