Skip to content

Commit 526ee72

Browse files
committed
debugfs: remove return value of debugfs_create_file_size()
No one checks the return value of debugfs_create_file_size, as it's not needed, so make the return value void, so that no one tries to do so in the future. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20200309163640.237984-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 275678e commit 526ee72

3 files changed

Lines changed: 17 additions & 29 deletions

File tree

‎Documentation/filesystems/debugfs.txt‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ missing.
5555
Create a file with an initial size, the following function can be used
5656
instead:
5757

58-
struct dentry *debugfs_create_file_size(const char *name, umode_t mode,
59-
struct dentry *parent, void *data,
60-
const struct file_operations *fops,
61-
loff_t file_size);
58+
void debugfs_create_file_size(const char *name, umode_t mode,
59+
struct dentry *parent, void *data,
60+
const struct file_operations *fops,
61+
loff_t file_size);
6262

6363
file_size is the initial file size. The other parameters are the same
6464
as the function debugfs_create_file.

‎fs/debugfs/inode.c‎

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -501,26 +501,16 @@ EXPORT_SYMBOL_GPL(debugfs_create_file_unsafe);
501501
* wide range of flexibility in creating a file, or a directory (if you want
502502
* to create a directory, the debugfs_create_dir() function is
503503
* recommended to be used instead.)
504-
*
505-
* This function will return a pointer to a dentry if it succeeds. This
506-
* pointer must be passed to the debugfs_remove() function when the file is
507-
* to be removed (no automatic cleanup happens if your module is unloaded,
508-
* you are responsible here.) If an error occurs, ERR_PTR(-ERROR) will be
509-
* returned.
510-
*
511-
* If debugfs is not enabled in the kernel, the value -%ENODEV will be
512-
* returned.
513504
*/
514-
struct dentry *debugfs_create_file_size(const char *name, umode_t mode,
515-
struct dentry *parent, void *data,
516-
const struct file_operations *fops,
517-
loff_t file_size)
505+
void debugfs_create_file_size(const char *name, umode_t mode,
506+
struct dentry *parent, void *data,
507+
const struct file_operations *fops,
508+
loff_t file_size)
518509
{
519510
struct dentry *de = debugfs_create_file(name, mode, parent, data, fops);
520511

521512
if (de)
522513
d_inode(de)->i_size = file_size;
523-
return de;
524514
}
525515
EXPORT_SYMBOL_GPL(debugfs_create_file_size);
526516

‎include/linux/debugfs.h‎

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ struct dentry *debugfs_create_file_unsafe(const char *name, umode_t mode,
6767
struct dentry *parent, void *data,
6868
const struct file_operations *fops);
6969

70-
struct dentry *debugfs_create_file_size(const char *name, umode_t mode,
71-
struct dentry *parent, void *data,
72-
const struct file_operations *fops,
73-
loff_t file_size);
70+
void debugfs_create_file_size(const char *name, umode_t mode,
71+
struct dentry *parent, void *data,
72+
const struct file_operations *fops,
73+
loff_t file_size);
7474

7575
struct dentry *debugfs_create_dir(const char *name, struct dentry *parent);
7676

@@ -181,13 +181,11 @@ static inline struct dentry *debugfs_create_file_unsafe(const char *name,
181181
return ERR_PTR(-ENODEV);
182182
}
183183

184-
static inline struct dentry *debugfs_create_file_size(const char *name, umode_t mode,
185-
struct dentry *parent, void *data,
186-
const struct file_operations *fops,
187-
loff_t file_size)
188-
{
189-
return ERR_PTR(-ENODEV);
190-
}
184+
static inline void debugfs_create_file_size(const char *name, umode_t mode,
185+
struct dentry *parent, void *data,
186+
const struct file_operations *fops,
187+
loff_t file_size)
188+
{ }
191189

192190
static inline struct dentry *debugfs_create_dir(const char *name,
193191
struct dentry *parent)

0 commit comments

Comments
 (0)