We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2aee30b commit 6697daeCopy full SHA for 6697dae
drivers/mtd/mtdcore.c
@@ -741,7 +741,9 @@ int add_mtd_device(struct mtd_info *mtd)
741
mtd->dev.type = &mtd_devtype;
742
mtd->dev.class = &mtd_class;
743
mtd->dev.devt = MTD_DEVT(i);
744
- dev_set_name(&mtd->dev, "mtd%d", i);
+ error = dev_set_name(&mtd->dev, "mtd%d", i);
745
+ if (error)
746
+ goto fail_devname;
747
dev_set_drvdata(&mtd->dev, mtd);
748
mtd_check_of_node(mtd);
749
of_node_get(mtd_get_of_node(mtd));
@@ -790,6 +792,7 @@ int add_mtd_device(struct mtd_info *mtd)
790
792
device_unregister(&mtd->dev);
791
793
fail_added:
794
of_node_put(mtd_get_of_node(mtd));
795
+fail_devname:
796
idr_remove(&mtd_idr, i);
797
fail_locked:
798
mutex_unlock(&mtd_table_mutex);
0 commit comments