Skip to content

Commit bc9832c

Browse files
committed
USB: typec: fsusb302: no need to check return value of debugfs_create_dir()
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. Clean up the fsusb302 driver to not care if the root directory was created, as the code should work properly either way. Cc: Heikki Krogerus <[email protected]> Cc: Hans de Goede <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: Adam Thomson <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e15bea0 commit bc9832c

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

drivers/usb/typec/fusb302/fusb302.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -215,20 +215,15 @@ DEFINE_SHOW_ATTRIBUTE(fusb302_debug);
215215

216216
static struct dentry *rootdir;
217217

218-
static int fusb302_debugfs_init(struct fusb302_chip *chip)
218+
static void fusb302_debugfs_init(struct fusb302_chip *chip)
219219
{
220220
mutex_init(&chip->logbuffer_lock);
221-
if (!rootdir) {
221+
if (!rootdir)
222222
rootdir = debugfs_create_dir("fusb302", NULL);
223-
if (!rootdir)
224-
return -ENOMEM;
225-
}
226223

227224
chip->dentry = debugfs_create_file(dev_name(chip->dev),
228225
S_IFREG | 0444, rootdir,
229226
chip, &fusb302_debug_fops);
230-
231-
return 0;
232227
}
233228

234229
static void fusb302_debugfs_exit(struct fusb302_chip *chip)
@@ -241,7 +236,7 @@ static void fusb302_debugfs_exit(struct fusb302_chip *chip)
241236

242237
static void fusb302_log(const struct fusb302_chip *chip,
243238
const char *fmt, ...) { }
244-
static int fusb302_debugfs_init(const struct fusb302_chip *chip) { return 0; }
239+
static void fusb302_debugfs_init(const struct fusb302_chip *chip) { }
245240
static void fusb302_debugfs_exit(const struct fusb302_chip *chip) { }
246241

247242
#endif
@@ -1773,9 +1768,7 @@ static int fusb302_probe(struct i2c_client *client,
17731768
return -EPROBE_DEFER;
17741769
}
17751770

1776-
ret = fusb302_debugfs_init(chip);
1777-
if (ret < 0)
1778-
return ret;
1771+
fusb302_debugfs_init(chip);
17791772

17801773
chip->wq = create_singlethread_workqueue(dev_name(chip->dev));
17811774
if (!chip->wq) {

0 commit comments

Comments
 (0)