aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-31 07:08:54 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-31 10:03:59 -0400
commitbc9832c4a1921a662870d51f81a699ec8c18545f (patch)
tree431caba6e0cb5ded42a41a85128a9fc65a41f620
parente15bea0f3f75d4ee8f13b5ea76dcd210b24ef226 (diff)
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 <heikki.krogerus@linux.intel.com> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/typec/fusb302/fusb302.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/usb/typec/fusb302/fusb302.c b/drivers/usb/typec/fusb302/fusb302.c
index 9c1eba9ea004..1e68da10bf17 100644
--- a/drivers/usb/typec/fusb302/fusb302.c
+++ b/drivers/usb/typec/fusb302/fusb302.c
@@ -215,20 +215,15 @@ DEFINE_SHOW_ATTRIBUTE(fusb302_debug);
215 215
216static struct dentry *rootdir; 216static struct dentry *rootdir;
217 217
218static int fusb302_debugfs_init(struct fusb302_chip *chip) 218static void fusb302_debugfs_init(struct fusb302_chip *chip)
219{ 219{
220 mutex_init(&chip->logbuffer_lock); 220 mutex_init(&chip->logbuffer_lock);
221 if (!rootdir) { 221 if (!rootdir)
222 rootdir = debugfs_create_dir("fusb302", NULL); 222 rootdir = debugfs_create_dir("fusb302", NULL);
223 if (!rootdir)
224 return -ENOMEM;
225 }
226 223
227 chip->dentry = debugfs_create_file(dev_name(chip->dev), 224 chip->dentry = debugfs_create_file(dev_name(chip->dev),
228 S_IFREG | 0444, rootdir, 225 S_IFREG | 0444, rootdir,
229 chip, &fusb302_debug_fops); 226 chip, &fusb302_debug_fops);
230
231 return 0;
232} 227}
233 228
234static void fusb302_debugfs_exit(struct fusb302_chip *chip) 229static void fusb302_debugfs_exit(struct fusb302_chip *chip)
@@ -241,7 +236,7 @@ static void fusb302_debugfs_exit(struct fusb302_chip *chip)
241 236
242static void fusb302_log(const struct fusb302_chip *chip, 237static void fusb302_log(const struct fusb302_chip *chip,
243 const char *fmt, ...) { } 238 const char *fmt, ...) { }
244static int fusb302_debugfs_init(const struct fusb302_chip *chip) { return 0; } 239static void fusb302_debugfs_init(const struct fusb302_chip *chip) { }
245static void fusb302_debugfs_exit(const struct fusb302_chip *chip) { } 240static void fusb302_debugfs_exit(const struct fusb302_chip *chip) { }
246 241
247#endif 242#endif
@@ -1773,9 +1768,7 @@ static int fusb302_probe(struct i2c_client *client,
1773 return -EPROBE_DEFER; 1768 return -EPROBE_DEFER;
1774 } 1769 }
1775 1770
1776 ret = fusb302_debugfs_init(chip); 1771 fusb302_debugfs_init(chip);
1777 if (ret < 0)
1778 return ret;
1779 1772
1780 chip->wq = create_singlethread_workqueue(dev_name(chip->dev)); 1773 chip->wq = create_singlethread_workqueue(dev_name(chip->dev));
1781 if (!chip->wq) { 1774 if (!chip->wq) {