Skip to content

Commit 8915aac

Browse files
gregkhjic23
authored andcommitted
iio: core: no need to check return value of debugfs_create functions
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Jonathan Cameron <[email protected]> Cc: Hartmut Knaack <[email protected]> Cc: Lars-Peter Clausen <[email protected]> Cc: Peter Meerwald-Stadler <[email protected]> Cc: [email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 1c349f4 commit 8915aac

File tree

1 file changed

+8
-27
lines changed

1 file changed

+8
-27
lines changed

drivers/iio/industrialio-core.c

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -369,39 +369,25 @@ static void iio_device_unregister_debugfs(struct iio_dev *indio_dev)
369369
debugfs_remove_recursive(indio_dev->debugfs_dentry);
370370
}
371371

372-
static int iio_device_register_debugfs(struct iio_dev *indio_dev)
372+
static void iio_device_register_debugfs(struct iio_dev *indio_dev)
373373
{
374-
struct dentry *d;
375-
376374
if (indio_dev->info->debugfs_reg_access == NULL)
377-
return 0;
375+
return;
378376

379377
if (!iio_debugfs_dentry)
380-
return 0;
378+
return;
381379

382380
indio_dev->debugfs_dentry =
383381
debugfs_create_dir(dev_name(&indio_dev->dev),
384382
iio_debugfs_dentry);
385-
if (indio_dev->debugfs_dentry == NULL) {
386-
dev_warn(indio_dev->dev.parent,
387-
"Failed to create debugfs directory\n");
388-
return -EFAULT;
389-
}
390-
391-
d = debugfs_create_file("direct_reg_access", 0644,
392-
indio_dev->debugfs_dentry,
393-
indio_dev, &iio_debugfs_reg_fops);
394-
if (!d) {
395-
iio_device_unregister_debugfs(indio_dev);
396-
return -ENOMEM;
397-
}
398383

399-
return 0;
384+
debugfs_create_file("direct_reg_access", 0644,
385+
indio_dev->debugfs_dentry, indio_dev,
386+
&iio_debugfs_reg_fops);
400387
}
401388
#else
402-
static int iio_device_register_debugfs(struct iio_dev *indio_dev)
389+
static void iio_device_register_debugfs(struct iio_dev *indio_dev)
403390
{
404-
return 0;
405391
}
406392

407393
static void iio_device_unregister_debugfs(struct iio_dev *indio_dev)
@@ -1674,12 +1660,7 @@ int __iio_device_register(struct iio_dev *indio_dev, struct module *this_mod)
16741660
/* configure elements for the chrdev */
16751661
indio_dev->dev.devt = MKDEV(MAJOR(iio_devt), indio_dev->id);
16761662

1677-
ret = iio_device_register_debugfs(indio_dev);
1678-
if (ret) {
1679-
dev_err(indio_dev->dev.parent,
1680-
"Failed to register debugfs interfaces\n");
1681-
return ret;
1682-
}
1663+
iio_device_register_debugfs(indio_dev);
16831664

16841665
ret = iio_buffer_alloc_sysfs_and_mask(indio_dev);
16851666
if (ret) {

0 commit comments

Comments
 (0)