Skip to content

Commit a02e98b

Browse files
Li Zetaoaxboe
authored andcommitted
mtip32xx: Remove redundant null pointer checks in mtip_hw_debugfs_init()
Since the debugfs_create_dir() never returns a null pointer, checking the return value for a null pointer is redundant. Since debugfs_create_file() can deal with a ERR_PTR() style pointer, drop the check. Since mtip_hw_debugfs_init does not pay attention to the return value, its return type can be changed to void. Signed-off-by: Li Zetao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 68f31e8 commit a02e98b

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

drivers/block/mtip32xx/mtip32xx.c

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2269,25 +2269,12 @@ static const struct file_operations mtip_flags_fops = {
22692269
.llseek = no_llseek,
22702270
};
22712271

2272-
static int mtip_hw_debugfs_init(struct driver_data *dd)
2272+
static void mtip_hw_debugfs_init(struct driver_data *dd)
22732273
{
2274-
if (!dfs_parent)
2275-
return -1;
2276-
22772274
dd->dfs_node = debugfs_create_dir(dd->disk->disk_name, dfs_parent);
2278-
if (IS_ERR_OR_NULL(dd->dfs_node)) {
2279-
dev_warn(&dd->pdev->dev,
2280-
"Error creating node %s under debugfs\n",
2281-
dd->disk->disk_name);
2282-
dd->dfs_node = NULL;
2283-
return -1;
2284-
}
2285-
22862275
debugfs_create_file("flags", 0444, dd->dfs_node, dd, &mtip_flags_fops);
22872276
debugfs_create_file("registers", 0444, dd->dfs_node, dd,
22882277
&mtip_regs_fops);
2289-
2290-
return 0;
22912278
}
22922279

22932280
static void mtip_hw_debugfs_exit(struct driver_data *dd)
@@ -4043,10 +4030,6 @@ static int __init mtip_init(void)
40434030
mtip_major = error;
40444031

40454032
dfs_parent = debugfs_create_dir("rssd", NULL);
4046-
if (IS_ERR_OR_NULL(dfs_parent)) {
4047-
pr_warn("Error creating debugfs parent\n");
4048-
dfs_parent = NULL;
4049-
}
40504033

40514034
/* Register our PCI operations. */
40524035
error = pci_register_driver(&mtip_pci_driver);

0 commit comments

Comments
 (0)