Skip to contentSkip to conversation

media: NULL check is meaningless before debugfs_remove_recursive

PATCH In review zhong jiang 2 participants 3 messages Aug 17, 2018

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

PATCH 1/1 media: NULL check is meaningless before debugfs_remove_recursive

debugfs_remove_recursive has taken null pointer into account. so remove the unneeded check.

---
 drivers/media/usb/uvc/uvc_debugfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/usb/uvc/uvc_debugfs.c +1 -2
index 368f8f8..6995aeb 100644
@@ -128,6 +128,5 @@ void uvc_debugfs_init(void)
 
 void uvc_debugfs_cleanup(void)
 {
-	if (uvc_debugfs_root_dir != NULL)
-		debugfs_remove_recursive(uvc_debugfs_root_dir);
+	debugfs_remove_recursive(uvc_debugfs_root_dir);
 }
Signature · 1 line
1.7.12.4
maintainer
#1 lore raw

Hi Zhong,

Thank you for the patch.

Quoted 4 lines · On Friday, 17 August 2018 06:37:26 EEST zhong jiang wrote:

debugfs_remove_recursive has taken null pointer into account. so remove the unneeded check.

I already have a similar patch in my tree (git://linuxtv.org/pinchartl/
media.git uvc/next) and will include it in my pull request for v4.20.

Quoted 16 lines
---
 drivers/media/usb/uvc/uvc_debugfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/media/usb/uvc/uvc_debugfs.c index 368f8f8..6995aeb 100644

drivers/media/usb/uvc/uvc_debugfs.c +1 -2
@@ -128,6 +128,5 @@ void uvc_debugfs_init(void)
 
 void uvc_debugfs_cleanup(void)
 {
-	if (uvc_debugfs_root_dir != NULL)
-		debugfs_remove_recursive(uvc_debugfs_root_dir);
+	debugfs_remove_recursive(uvc_debugfs_root_dir);
 }
Signature · 3 lines
Regards,

Laurent Pinchart
#2 lore raw
Quoted 11 lines · Laurent Pinchart

Hi Zhong,

Thank you for the patch.

Quoted 4 lines · On Friday, 17 August 2018 06:37:26 EEST zhong jiang wrote:

debugfs_remove_recursive has taken null pointer into account. so remove the unneeded check.

I already have a similar patch in my tree (git://linuxtv.org/pinchartl/
media.git uvc/next) and will include it in my pull request for v4.20.

Thank you for let me know that. Maybe I miss that.

Sincerely,
zhong jiang

Quoted 16 lines
Quoted 16 lines
---
 drivers/media/usb/uvc/uvc_debugfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/media/usb/uvc/uvc_debugfs.c index 368f8f8..6995aeb 100644

drivers/media/usb/uvc/uvc_debugfs.c +1 -2
@@ -128,6 +128,5 @@ void uvc_debugfs_init(void)
 
 void uvc_debugfs_cleanup(void)
 {
-	if (uvc_debugfs_root_dir != NULL)
-		debugfs_remove_recursive(uvc_debugfs_root_dir);
+	debugfs_remove_recursive(uvc_debugfs_root_dir);
 }