summaryrefslogtreecommitdiffstats
path: root/drivers/lightnvm
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/lightnvm')
-rw-r--r--drivers/lightnvm/lightnvm.h2
-rw-r--r--drivers/lightnvm/sysfs.c9
2 files changed, 7 insertions, 4 deletions
diff --git a/drivers/lightnvm/lightnvm.h b/drivers/lightnvm/lightnvm.h
index 93f1aacc9f02..305c181509a6 100644
--- a/drivers/lightnvm/lightnvm.h
+++ b/drivers/lightnvm/lightnvm.h
@@ -24,7 +24,7 @@
#include <linux/lightnvm.h>
/* core -> sysfs.c */
-int nvm_sysfs_register_dev(struct nvm_dev *);
+int __must_check nvm_sysfs_register_dev(struct nvm_dev *);
void nvm_sysfs_unregister_dev(struct nvm_dev *);
int nvm_sysfs_register(void);
void nvm_sysfs_unregister(void);
diff --git a/drivers/lightnvm/sysfs.c b/drivers/lightnvm/sysfs.c
index 72ad089c0269..0338c27ab95a 100644
--- a/drivers/lightnvm/sysfs.c
+++ b/drivers/lightnvm/sysfs.c
@@ -174,6 +174,8 @@ static struct device_type nvm_type = {
int nvm_sysfs_register_dev(struct nvm_dev *dev)
{
+ int ret;
+
if (!dev->parent_dev)
return 0;
@@ -181,11 +183,12 @@ int nvm_sysfs_register_dev(struct nvm_dev *dev)
dev_set_name(&dev->dev, "%s", dev->name);
dev->dev.type = &nvm_type;
device_initialize(&dev->dev);
- device_add(&dev->dev);
+ ret = device_add(&dev->dev);
- blk_mq_register_dev(&dev->dev, dev->q);
+ if (!ret)
+ blk_mq_register_dev(&dev->dev, dev->q);
- return 0;
+ return ret;
}
void nvm_sysfs_unregister_dev(struct nvm_dev *dev)