[PATCH v3 12/29] platform/x86: ideapad-laptop: check return value of debugfs_create_dir() for errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



debugfs_create_dir() may return an ERR_PTR(),
add a check to ideapad_debugfs_init() that
handles the case when that occurs.

Signed-off-by: Barnabás Pőcze <pobrn@xxxxxxxxxxxxxx>

diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index 1aa3a05c3360..ba0bd344f5ed 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -14,6 +14,7 @@
 #include <linux/debugfs.h>
 #include <linux/device.h>
 #include <linux/dmi.h>
+#include <linux/err.h>
 #include <linux/fb.h>
 #include <linux/i8042.h>
 #include <linux/init.h>
@@ -350,9 +351,11 @@ DEFINE_SHOW_ATTRIBUTE(debugfs_cfg);
 
 static void ideapad_debugfs_init(struct ideapad_private *priv)
 {
-	struct dentry *dir;
+	struct dentry *dir = debugfs_create_dir("ideapad", NULL);
+
+	if (IS_ERR(dir))
+		return;
 
-	dir = debugfs_create_dir("ideapad", NULL);
 	priv->debug = dir;
 
 	debugfs_create_file("cfg", S_IRUGO, dir, priv, &debugfs_cfg_fops);
-- 
2.30.0






[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux