Skip to contentSkip to conversation

uvcvideo: change result code of debugfs_init to void

PATCH In review Jaejoong Kim 2 participants 2 messages Jan 12, 2017 – Jan 19, 2017

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

PATCH 1/1 uvcvideo: change result code of debugfs_init to void

The device driver should keep going even if debugfs initialization fails. So, change the return type to void.

---
 drivers/media/usb/uvc/uvc_debugfs.c | 15 ++++++---------
 drivers/media/usb/uvc/uvcvideo.h    |  4 ++--
 2 files changed, 8 insertions(+), 11 deletions(-)
drivers/media/usb/uvc/uvc_debugfs.c +6 -9
index 14561a5..368f8f8 100644
@@ -75,14 +75,14 @@ static const struct file_operations uvc_debugfs_stats_fops = {
 
 static struct dentry *uvc_debugfs_root_dir;
 
-int uvc_debugfs_init_stream(struct uvc_streaming *stream)
+void uvc_debugfs_init_stream(struct uvc_streaming *stream)
 {
 	struct usb_device *udev = stream->dev->udev;
 	struct dentry *dent;
 	char dir_name[32];
 
 	if (uvc_debugfs_root_dir == NULL)
-		return -ENODEV;
+		return;
 
 	sprintf(dir_name, "%u-%u", udev->bus->busnum, udev->devnum);
 
@@ -90,7 +90,7 @@ int uvc_debugfs_init_stream(struct uvc_streaming *stream)
 	if (IS_ERR_OR_NULL(dent)) {
 		uvc_printk(KERN_INFO, "Unable to create debugfs %s "
 			   "directory.\n", dir_name);
-		return -ENODEV;
+		return;
 	}
 
 	stream->debugfs_dir = dent;
@@ -100,10 +100,8 @@ int uvc_debugfs_init_stream(struct uvc_streaming *stream)
 	if (IS_ERR_OR_NULL(dent)) {
 		uvc_printk(KERN_INFO, "Unable to create debugfs stats file.\n");
 		uvc_debugfs_cleanup_stream(stream);
-		return -ENODEV;
+		return;
 	}
-
-	return 0;
 }
 
 void uvc_debugfs_cleanup_stream(struct uvc_streaming *stream)
@@ -115,18 +113,17 @@ void uvc_debugfs_cleanup_stream(struct uvc_streaming *stream)
 	stream->debugfs_dir = NULL;
 }
 
-int uvc_debugfs_init(void)
+void uvc_debugfs_init(void)
 {
 	struct dentry *dir;
 
 	dir = debugfs_create_dir("uvcvideo", usb_debug_root);
 	if (IS_ERR_OR_NULL(dir)) {
 		uvc_printk(KERN_INFO, "Unable to create debugfs directory\n");
-		return -ENODATA;
+		return;
 	}
 
 	uvc_debugfs_root_dir = dir;
-	return 0;
 }
 
 void uvc_debugfs_cleanup(void)
drivers/media/usb/uvc/uvcvideo.h +2 -2
index 7e4d3ee..1d1b992 100644
@@ -745,9 +745,9 @@ void uvc_video_decode_isight(struct urb *urb, struct uvc_streaming *stream,
 		struct uvc_buffer *buf);
 
 /* debugfs and statistics */
-int uvc_debugfs_init(void);
+void uvc_debugfs_init(void);
 void uvc_debugfs_cleanup(void);
-int uvc_debugfs_init_stream(struct uvc_streaming *stream);
+void uvc_debugfs_init_stream(struct uvc_streaming *stream);
 void uvc_debugfs_cleanup_stream(struct uvc_streaming *stream);
 
 size_t uvc_video_stats_dump(struct uvc_streaming *stream, char *buf,
Signature · 1 line
2.7.4
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi Jaejoong,

Thank you for the patch.

Quoted 4 lines · On Thursday 12 Jan 2017 10:31:21 Jaejoong Kim wrote:

The device driver should keep going even if debugfs initialization fails. So, change the return type to void.

and applied to my tree. I'll send a pull request for v4.11.

Quoted 37 lines
---
 drivers/media/usb/uvc/uvc_debugfs.c | 15 ++++++---------
 drivers/media/usb/uvc/uvcvideo.h    |  4 ++--
 2 files changed, 8 insertions(+), 11 deletions(-)
(quoted diff) +0 -0

b/drivers/media/usb/uvc/uvc_debugfs.c index 14561a5..368f8f8 100644

drivers/media/usb/uvc/uvc_debugfs.c +3 -3
@@ -75,14 +75,14 @@ static const struct file_operations
 uvc_debugfs_stats_fops = {
 
 static struct dentry *uvc_debugfs_root_dir;
 
-int uvc_debugfs_init_stream(struct uvc_streaming *stream)
+void uvc_debugfs_init_stream(struct uvc_streaming *stream)
 {
 	struct usb_device *udev = stream->dev->udev;
 	struct dentry *dent;
 	char dir_name[32];
 
 	if (uvc_debugfs_root_dir == NULL)
-		return -ENODEV;
+		return;
 
 	sprintf(dir_name, "%u-%u", udev->bus->busnum, udev->devnum);
@@ -90,7 +90,7 @@ int uvc_debugfs_init_stream(struct uvc_streaming *stream)
 	if (IS_ERR_OR_NULL(dent)) {
 		uvc_printk(KERN_INFO, "Unable to create debugfs %s "
 			   "directory.\n", dir_name);
-		return -ENODEV;
+		return;
 	}
 
 	stream->debugfs_dir = dent;

drivers/media/usb/uvc/uvc_debugfs.c int uvc_debugfs_init_stream(struct uvc_streaming · line 101

Quoted 2 lines
drivers/media/usb/uvc/uvc_debugfs.c +0 -0
@@ -100,10 +100,8 @@ int uvc_debugfs_init_stream(struct uvc_streaming
 *stream) if (IS_ERR_OR_NULL(dent)) {
 		uvc_printk(KERN_INFO, "Unable to create debugfs stats file.

\n");

Quoted 46 lines
drivers/media/usb/uvc/uvc_debugfs.c +3 -6
 		uvc_debugfs_cleanup_stream(stream);
-		return -ENODEV;
+		return;
 	}
-
-	return 0;
 }
 
 void uvc_debugfs_cleanup_stream(struct uvc_streaming *stream)
@@ -115,18 +113,17 @@ void uvc_debugfs_cleanup_stream(struct uvc_streaming
 *stream) stream->debugfs_dir = NULL;
 }
 
-int uvc_debugfs_init(void)
+void uvc_debugfs_init(void)
 {
 	struct dentry *dir;
 
 	dir = debugfs_create_dir("uvcvideo", usb_debug_root);
 	if (IS_ERR_OR_NULL(dir)) {
 		uvc_printk(KERN_INFO, "Unable to create debugfs directory\n");
-		return -ENODATA;
+		return;
 	}
 
 	uvc_debugfs_root_dir = dir;
-	return 0;
 }
 
 void uvc_debugfs_cleanup(void)
(quoted diff) +0 -0

b/drivers/media/usb/uvc/uvcvideo.h index 7e4d3ee..1d1b992 100644

drivers/media/usb/uvc/uvcvideo.h +2 -2
@@ -745,9 +745,9 @@ void uvc_video_decode_isight(struct urb *urb, struct
 uvc_streaming *stream, struct uvc_buffer *buf);
 
 /* debugfs and statistics */
-int uvc_debugfs_init(void);
+void uvc_debugfs_init(void);
 void uvc_debugfs_cleanup(void);
-int uvc_debugfs_init_stream(struct uvc_streaming *stream);
+void uvc_debugfs_init_stream(struct uvc_streaming *stream);
 void uvc_debugfs_cleanup_stream(struct uvc_streaming *stream);
 
 size_t uvc_video_stats_dump(struct uvc_streaming *stream, char *buf,
Signature · 3 lines
Regards,

Laurent Pinchart