summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-12 08:12:55 -0400
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2019-06-17 08:20:58 -0400
commitd30cdc9a8adb1d18a2eed47dceaa2998adf5f47d (patch)
tree2a24f21efb66b7c32cd4ce138aefe0620ccdacdf
parent17f1bf38c8821ce851d95708a1f1e226d17ec2c5 (diff)
platform/x86: samsung-laptop: 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: Corentin Chary <corentin.chary@gmail.com> Cc: Darren Hart <dvhart@infradead.org> Cc: Andy Shevchenko <andy@infradead.org> Cc: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-rw-r--r--drivers/platform/x86/samsung-laptop.c89
1 files changed, 23 insertions, 66 deletions
diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
index 7b160ee98115..e84f11398c1b 100644
--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -1280,15 +1280,12 @@ static void samsung_debugfs_exit(struct samsung_laptop *samsung)
1280 debugfs_remove_recursive(samsung->debug.root); 1280 debugfs_remove_recursive(samsung->debug.root);
1281} 1281}
1282 1282
1283static int samsung_debugfs_init(struct samsung_laptop *samsung) 1283static void samsung_debugfs_init(struct samsung_laptop *samsung)
1284{ 1284{
1285 struct dentry *dent; 1285 struct dentry *root;
1286 1286
1287 samsung->debug.root = debugfs_create_dir("samsung-laptop", NULL); 1287 root = debugfs_create_dir("samsung-laptop", NULL);
1288 if (!samsung->debug.root) { 1288 samsung->debug.root = root;
1289 pr_err("failed to create debugfs directory");
1290 goto error_debugfs;
1291 }
1292 1289
1293 samsung->debug.f0000_wrapper.data = samsung->f0000_segment; 1290 samsung->debug.f0000_wrapper.data = samsung->f0000_segment;
1294 samsung->debug.f0000_wrapper.size = 0xffff; 1291 samsung->debug.f0000_wrapper.size = 0xffff;
@@ -1299,60 +1296,24 @@ static int samsung_debugfs_init(struct samsung_laptop *samsung)
1299 samsung->debug.sdiag_wrapper.data = samsung->sdiag; 1296 samsung->debug.sdiag_wrapper.data = samsung->sdiag;
1300 samsung->debug.sdiag_wrapper.size = strlen(samsung->sdiag); 1297 samsung->debug.sdiag_wrapper.size = strlen(samsung->sdiag);
1301 1298
1302 dent = debugfs_create_u16("command", S_IRUGO | S_IWUSR, 1299 debugfs_create_u16("command", S_IRUGO | S_IWUSR, root,
1303 samsung->debug.root, &samsung->debug.command); 1300 &samsung->debug.command);
1304 if (!dent) 1301 debugfs_create_u32("d0", S_IRUGO | S_IWUSR, root,
1305 goto error_debugfs; 1302 &samsung->debug.data.d0);
1306 1303 debugfs_create_u32("d1", S_IRUGO | S_IWUSR, root,
1307 dent = debugfs_create_u32("d0", S_IRUGO | S_IWUSR, samsung->debug.root, 1304 &samsung->debug.data.d1);
1308 &samsung->debug.data.d0); 1305 debugfs_create_u16("d2", S_IRUGO | S_IWUSR, root,
1309 if (!dent) 1306 &samsung->debug.data.d2);
1310 goto error_debugfs; 1307 debugfs_create_u8("d3", S_IRUGO | S_IWUSR, root,
1311 1308 &samsung->debug.data.d3);
1312 dent = debugfs_create_u32("d1", S_IRUGO | S_IWUSR, samsung->debug.root, 1309 debugfs_create_blob("data", S_IRUGO | S_IWUSR, root,
1313 &samsung->debug.data.d1); 1310 &samsung->debug.data_wrapper);
1314 if (!dent) 1311 debugfs_create_blob("f0000_segment", S_IRUSR | S_IWUSR, root,
1315 goto error_debugfs; 1312 &samsung->debug.f0000_wrapper);
1316 1313 debugfs_create_file("call", S_IFREG | S_IRUGO, root, samsung,
1317 dent = debugfs_create_u16("d2", S_IRUGO | S_IWUSR, samsung->debug.root, 1314 &samsung_laptop_call_fops);
1318 &samsung->debug.data.d2); 1315 debugfs_create_blob("sdiag", S_IRUGO | S_IWUSR, root,
1319 if (!dent) 1316 &samsung->debug.sdiag_wrapper);
1320 goto error_debugfs;
1321
1322 dent = debugfs_create_u8("d3", S_IRUGO | S_IWUSR, samsung->debug.root,
1323 &samsung->debug.data.d3);
1324 if (!dent)
1325 goto error_debugfs;
1326
1327 dent = debugfs_create_blob("data", S_IRUGO | S_IWUSR,
1328 samsung->debug.root,
1329 &samsung->debug.data_wrapper);
1330 if (!dent)
1331 goto error_debugfs;
1332
1333 dent = debugfs_create_blob("f0000_segment", S_IRUSR | S_IWUSR,
1334 samsung->debug.root,
1335 &samsung->debug.f0000_wrapper);
1336 if (!dent)
1337 goto error_debugfs;
1338
1339 dent = debugfs_create_file("call", S_IFREG | S_IRUGO,
1340 samsung->debug.root, samsung,
1341 &samsung_laptop_call_fops);
1342 if (!dent)
1343 goto error_debugfs;
1344
1345 dent = debugfs_create_blob("sdiag", S_IRUGO | S_IWUSR,
1346 samsung->debug.root,
1347 &samsung->debug.sdiag_wrapper);
1348 if (!dent)
1349 goto error_debugfs;
1350
1351 return 0;
1352
1353error_debugfs:
1354 samsung_debugfs_exit(samsung);
1355 return -ENOMEM;
1356} 1317}
1357 1318
1358static void samsung_sabi_exit(struct samsung_laptop *samsung) 1319static void samsung_sabi_exit(struct samsung_laptop *samsung)
@@ -1745,9 +1706,7 @@ static int __init samsung_init(void)
1745 if (ret) 1706 if (ret)
1746 goto error_lid_handling; 1707 goto error_lid_handling;
1747 1708
1748 ret = samsung_debugfs_init(samsung); 1709 samsung_debugfs_init(samsung);
1749 if (ret)
1750 goto error_debugfs;
1751 1710
1752 samsung->pm_nb.notifier_call = samsung_pm_notification; 1711 samsung->pm_nb.notifier_call = samsung_pm_notification;
1753 register_pm_notifier(&samsung->pm_nb); 1712 register_pm_notifier(&samsung->pm_nb);
@@ -1755,8 +1714,6 @@ static int __init samsung_init(void)
1755 samsung_platform_device = samsung->platform_device; 1714 samsung_platform_device = samsung->platform_device;
1756 return ret; 1715 return ret;
1757 1716
1758error_debugfs:
1759 samsung_lid_handling_exit(samsung);
1760error_lid_handling: 1717error_lid_handling:
1761 samsung_leds_exit(samsung); 1718 samsung_leds_exit(samsung);
1762error_leds: 1719error_leds: